Fixed possible floating point precision errors