Fix a small overlapping bug in path finding