Fix bug in the my_distance dispatching.