Correct error in pathfinding.