Fix the variable and XML errors for rule refactoring

Found some bugs that stop the entity-initializer runs, the reason is the changes of variables, like tags, relations.

Edited by Chengzhi Rao