Fixed small bug related to distance value