Bug fix in calculation.