rule_engine.py fix