Fix pathfinding bug.