fixed error in distance.