added validation for setting the rules.