Fix rules.py bug