Lee's fix for CalculateMath errors