dirty_hash_to_rule was modifying it's argument

... causing other bugs to creep in.
Merge branch 'fix_dirty_hash_to_rule' into bug_fixes