fixed distance bug.