fix calc distance