fix buggy pathfinding