Fix a problem in the isValidUser function logic.