Fix floating-point bug