fix coordinate distance bug