fix to error in getMostCostEffectiveSolution2 function