Fixed redundant computation of best costs.