Fix the path filtering loop exit condition.