The distance is not updated correctly, fix the bug.
