bug in total distance