fix floating point math issue