anchor.diff:  reset_bind_state(State) ->
       maps:remove(bind_id, State).
   
  +-spec reset_session_state(state()) -> state().
  +reset_session_state(State) ->
  +    maps:remove(session_response_id, State).
  +
   -spec reset_state(state()) -> state().
   reset_state(State) ->
       State1 = reset_bind_state(State),
       State2 = reset_sasl_state(State1),
       State3 = reset_connection_state(State2),
  -    reset_stream_state(State3).
  +    State4 = reset_session_state(State3),
  +    reset_stream_state(State4).
   
   %%%===================================================================
   %%% Connection stuff
  
positive.code: 		      #{bind_id := ID} = State) ->
      Err = xmpp:get_error(IQ),
      State1 = reset_bind_state(State),
      try callback(handle_bind_failure, Err, State1)
      catch _:{?MODULE, undef} -> process_stream_end({bind, Err}, State1)
      end;
  process_bind_response(Pkt, State) ->
      process_packet(Pkt, State).
  
  -spec process_packet(xmpp_element(), state()) -> state().
  
negative.code:     try xmpp:try_subtag(IQ, #bind{}) of
  	#bind{jid = #jid{user = U, server = S, resource = R}} ->
  	    State2 = State1#{user => U, server => S, resource => R},
  	    case maps:get(session_response_id, State2, undefined) of
  		undefined ->
  		    State3 = try callback(handle_bind_success, State2)
  			     catch _:{?MODULE, undef} -> State2
  			     end,
  		    process_stream_established(State3);
  		SID ->
  		    Pkt = #iq{id = SID, type = set, to = jid:make(S),
  			      sub_els = [#xmpp_session{}]},
  		    State3 = State2#{stream_state => wait_for_session_response},
  		    send_pkt(State3, Pkt)
  	    end;
  	#bind{} ->
  	    Txt = <<"Missing <jid/> element in resource binding response">>,
  	    send_pkt(State1, xmpp:serr_invalid_xml(Txt, Lang));
  