Fixed bug due to rounding error in floats