Fix a few floating point rounding bugs