Fixed bug in Distance