Too many underlings -- not sure why

In Reaping Fire I summon 2 peasants even though I wanted to summon only 1 to collect coins. This ends up delaying my summoning of griffin riders which then allows the ogres to run into the mines really soon.

Can anyone help with my logic below?

// The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.

this.chooseStrategy = function() {
    var enemies = this.findEnemies();
    var peasants = this.findByType("peasant");
    // Get peasants to do the work
    if (this.gold >= this.costOf("peasant") && peasants.length < 2) {
        return "butler";
    }
    // If you can summon a griffin-rider, return "griffin-rider"
    else if (this.gold >= this.costOf("griffin-rider")) {
        return "griffin-rider";
    }
    // If there is a fangrider on your side of the mines, return "fight-back"
    for (var i = 0; i < enemies.length; i++) {
        var enemy = enemies[i];
        if (enemy.type == "fangrider") {
            return "fight-back";
        } else {
            return "collect-coins";
        }
    }
};

this.commandAttack = function() {
    // Command your griffin riders to attack ogres.
    var troops = this.findByType("griffin-rider");
    var butlers = this.findByType("peasant");
    for (var i = 0; i < troops.length; i++) {
        var troop = troops[i];
        var enemy = troop.findNearest(troop.findEnemies());
        if (enemy) {
            if (enemy.type !== "fangrider") {
            this.command(troop, "attack", enemy);
            }
        }
    }
    for (var b = 0; b < butlers.length; b++) {
        var butler = butlers[b];
        var pickup = butler.findNearest(butler.findItems());
        this.command(butler, "move", pickup.pos);
    }
};

this.pickUpCoin = function() {
    // Collect coins
    var coin = this.findNearest(this.findItems());
    if (coin) {
        this.move(coin.pos);
    }
};

this.heroAttack = function() {
    // Your hero should attack fang riders that cross the minefield.
    var target = this.findNearest(this.findEnemies());
    if (target && target.pos < 38) {
        if (this.isReady("throw") && this.distanceTo(target) < this.throwRange) {
            this.throw(target);
        }
        else if (this.canCast("chain-lightning", target)) {
            this.cast("chain-lightning", target);
        }
        else {
            this.attack(target);
        }
    }
};

this.healer = function() {
    if (this.isReady("heal") && this.health < this.maxHealth / 3) {
        this.heal(this);
    }
};

loop {
    this.commandAttack();
    var strategy = this.chooseStrategy();
    // Call a function, depending on what the current strategy is.
    if (strategy=="griffin-rider") {
        this.summon("griffin-rider");
    }
    else if (strategy=="butler") {
        this.summon("peasant");
    }
    else if (strategy=="fight-back") {
        this.heroAttack();
    }
    else {
        this.pickUpCoin();
    }
    this.healer();
}

One is less than two, right? Okay, just checking.

In your chooseStrategy function, you summon a peasant if you have more than 50 gold (the cost of a peasant) and if you have less than two peasants. Well, one peasant is less than two, right? And so you will summon two peasants.

what world is this on???