error fix in getdistance