fix pathfinding bug