Fixing a bug: mapping state to event has to be done after the execution termination...