Fix a bug when pathfinding couldn't finish