correct set_rule_for_states and add get_rule_for_states functions