trying to fix distance-calculation