fix UnitCommand generation function