Fix a bug caused by floating point imprecision.