fixing distance display in case of undefined