Fix A* pathfinding.