fixed cm_distance bug