add check that all rules are valid