Fix pathfinding crash