Fix issues in StateMachine and ValidatorGroup