Fixed small bug in CalculateMean