fixed a nasty floating point bug