anchor.diff:  			if
   				Length =:= 0, InBuffer =/= <<>> ->
   					FromPid ! {recv, FromSocket, {ok, InBuffer}},
  -					Children2 = lists:keyreplace(StreamID, #child.streamid,
  -						Children, Child#child{in_buffer= <<>>}),
  -					loop(State#state{children=Children2});
  +					loop(replace_child(Child#child{in_buffer= <<>>}, State));
   				byte_size(InBuffer) >= Length ->
   					<< Data:Length/binary, Rest/binary >> = InBuffer,
   					FromPid ! {recv, FromSocket, {ok, Data}},
  -					Children2 = lists:keyreplace(StreamID, #child.streamid,
  -						Children, Child#child{in_buffer=Rest}),
  -					loop(State#state{children=Children2});
  +					loop(replace_child(Child#child{in_buffer=Rest}, State));
   				true ->
  -					Children2 = lists:keyreplace(StreamID, #child.streamid,
  -						Children, Child#child{is_recv=
  -							{true, FromSocket, FromPid, Length}}),
  -					loop(State#state{children=Children2})
  +					loop(replace_child(Child#child{
  +						is_recv={true, FromSocket, FromPid, Length}}, State))
   			end;
   		{reply, {Pid, StreamID}, Status, Headers}
   				when Pid =:= self() ->
   			Child = #child{output=nofin} = get_child(StreamID, State),
   			syn_reply(State, StreamID, true, Status, Headers),
  -			loop(out_fin_child(Child, State));
  +			loop(replace_child(Child#child{output=fin}, State));
   		{reply, {Pid, StreamID}, Status, Headers, Body}
   				when Pid =:= self() ->
   			Child = #child{output=nofin} = get_child(StreamID, State),
   			syn_reply(State, StreamID, false, Status, Headers),
   			data(State, StreamID, true, Body),
  -			loop(out_fin_child(Child, State));
  +			loop(replace_child(Child#child{output=fin}, State));
   		{stream_reply, {Pid, StreamID}, Status, Headers}
   				when Pid =:= self() ->
   			#child{output=nofin} = get_child(StreamID, State),
  
positive.code: 				when Pid =:= self() ->
  			Child = #child{output=nofin} = get_child(StreamID, State),
  			data(State, StreamID, true, <<>>),
  			loop(out_fin_child(Child, State));
  		{sendfile, {Pid, StreamID}, Filepath}
  				when Pid =:= self() ->
  			Child = #child{output=nofin} = get_child(StreamID, State),
  			data_from_file(State, StreamID, Filepath),
  			loop(out_fin_child(Child, State));
  		{'EXIT', Parent, Reason} ->
  			exit(Reason);
  		{'EXIT', Pid, _} ->
  
negative.code: 		_ ->
  			Child#child{input=IsFin2, in_buffer=Data2}
  	end,
  	loop(replace_child(Child2, State));
  %% General error, can't recover.
  handle_frame(State, {error, badprotocol}) ->
  	goaway(State, protocol_error),
  