fixed distance bug

fixed distance bug