modify distance.py