fix bug in distance rounding