Fixing bugs in BackwardStateMachine.