Put removeRules INSIDE the null check. -.-