fixed bug in pathfinder that caused slow performance