Rewrite operation_match_requirements

Fix a buggy version