some bug fixes in server distance calculations