Correct the cost computation part