Fixed error in calculation