Misc. bugfixes in rules