fixes floating point rounding errors