Fixing various bugs in the rules