Checks if operator is valid