fix pathfinding performance