Fix up bugs in total_distance.