There was just no boolean logic to change the state back to the original state once a sensor was tripped and the function executed.
But in the original code you did set the isMatch variable to true before testing the inputs
What was wrong was that you had the logic inverted. Using a better name for the flag variable would have made that more obvious