Put removeRules INSIDE the null check. -.-
Merge pull request #482 from ntwitch/master

Put removeRules INSIDE the null check. -.-