anchor.diff:  		true ->
   		    NewDebug = do_reply(Debug, S, From, Reply),
   		    loop_event_actions(
  -		      Parent, NewDebug, S, Events, Event,
  -		      State, NextState, NewData, Actions,
  +		      Parent, NewDebug, S, Events,
  +		      State, NewData, P, Event, NextState, Actions,
   		      Postpone, Hibernate, Timeout, NextEvents);
   		false ->
  +		    NewS =
  +			S#{state := State, data := NewData, postponed := P},
  +		    Q = [Event|Events],
   		    ?TERMINATE(
  -		       error, {bad_action,Action}, Debug, S, [Event|Events])
  +		       error, {bad_action,Action}, Debug, NewS, Q)
   	    end;
   	{next_event,Type,Content} ->
   	    case event_type(Type) of
   		true ->
   		    loop_event_actions(
  -		      Parent, Debug, S, Events, Event,
  -		      State, NextState, NewData, Actions,
  +		      Parent, Debug, S, Events,
  +		      State, NewData, P, Event, NextState, Actions,
   		      Postpone, Hibernate, Timeout,
   		      [{Type,Content}|NextEvents]);
   		false ->
  +		    NewS =
  +			S#{state := State, data := NewData, postponed := P},
  +		    Q = [Event|Events],
   		    ?TERMINATE(
  -		       error, {bad_action,Action}, Debug, S, [Event|Events])
  +		       error, {bad_action,Action}, Debug, NewS, Q)
   	    end;
   	%% Actions that set options
   	{postpone,NewPostpone} when is_boolean(NewPostpone) ->
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      NewPostpone, Hibernate, Timeout, NextEvents);
   	{postpone,_} ->
  +	    NewS = S#{state := State, data := NewData, postponed := P},
  +	    Q = [Event|Events],
   	    ?TERMINATE(
  -	       error, {bad_action,Action}, Debug, S, [Event|Events]);
  +	       error, {bad_action,Action}, Debug, NewS, Q);
   	postpone ->
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      true, Hibernate, Timeout, NextEvents);
   	{hibernate,NewHibernate} when is_boolean(NewHibernate) ->
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      Postpone, NewHibernate, Timeout, NextEvents);
   	{hibernate,_} ->
  +	    NewS = S#{state := State, data := NewData, postponed := P},
  +	    Q = [Event|Events],
   	    ?TERMINATE(
  -	       error, {bad_action,Action}, Debug, S, [Event|Events]);
  +	       error, {bad_action,Action}, Debug, NewS, Q);
   	hibernate ->
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      Postpone, true, Timeout, NextEvents);
   	{timeout,infinity,_} -> % Clear timer - it will never trigger
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      Postpone, Hibernate, undefined, NextEvents);
   	{timeout,Time,_} = NewTimeout when is_integer(Time), Time >= 0 ->
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      Postpone, Hibernate, NewTimeout, NextEvents);
   	{timeout,_,_} ->
  +	    NewS = S#{state := State, data := NewData, postponed := P},
  +	    Q = [Event|Events],
   	    ?TERMINATE(
  -	       error, {bad_action,Action}, Debug, S, [Event|Events]);
  +	       error, {bad_action,Action}, Debug, NewS, Q);
   	infinity -> % Clear timer - it will never trigger
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      Postpone, Hibernate, undefined, NextEvents);
   	Time when is_integer(Time), Time >= 0 ->
   	    NewTimeout = {timeout,Time,Time},
   	    loop_event_actions(
  -	      Parent, Debug, S, Events, Event,
  -	      State, NextState, NewData, Actions,
  +	      Parent, Debug, S, Events,
  +	      State, NewData, P, Event, NextState, Actions,
   	      Postpone, Hibernate, NewTimeout, NextEvents);
   	_ ->
  +	    NewS = S#{state := State, data := NewData, postponed := P},
  +	    Q = [Event|Events],
   	    ?TERMINATE(
  -	       error, {bad_action,Action}, Debug, S, [Event|Events])
  +	       error, {bad_action,Action}, Debug, NewS, Q)
       end;
   %%
   %% End of actions list
   loop_event_actions(
  -  Parent, Debug, #{postponed := P0} = S, Events, Event,
  -  State, NextState, NewData, [],
  +  Parent, Debug, S, Events,
  +  State, NewData, P0, Event, NextState, [],
     Postpone, Hibernate, Timeout, NextEvents) ->
       %%
       %% All options have been collected and next_events are buffered.
  
positive.code:     %% would have happened if we actually hibernated
      %% and immediately was awakened
      Hibernate andalso garbage_collect(),
      try
  	case CallbackMode of
  	    state_functions ->
  
negative.code:       end,
        Postpone, Hibernate, Timeout, NextEvents).
  %%
  %% Process all actions
  loop_event_actions(
    Parent, Debug, S, Events,
    State, NewData, P, Event, NextState, [Action|Actions],
    Postpone, Hibernate, Timeout, NextEvents) ->
      case Action of
  	%% Actual actions
  