fix a bug in pathfinder