fix: prevent infinite loop if distance too short