diff --git a/lv6-ref-man/lv6-ref-man.pdf b/lv6-ref-man/lv6-ref-man.pdf
index 4565523c2f547630131afd6b96644c03ae301b3a..b25a9e05a37214909329b9ff23efff9d4013a155 100644
Binary files a/lv6-ref-man/lv6-ref-man.pdf and b/lv6-ref-man/lv6-ref-man.pdf differ
diff --git a/src/lv6Run.ml b/src/lv6Run.ml
index 6f1b5dc67ec82fd515290f1f6d29a6e0cad75206..1ae8cfa5922b7f15b954be29d6866511531860ae 100644
--- a/src/lv6Run.ml
+++ b/src/lv6Run.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 05/07/2018 (at 15:07) by Erwan Jahier> *)
+(* Time-stamp: <modified the 05/04/2019 (at 14:50) by Erwan Jahier> *)
 (*-----------------------------------------------------------------------
 ** Copyright (C) - Verimag.
 *)
@@ -70,6 +70,7 @@ let make_do argv opt =
       List.fold_left (fun acc (id,v) -> SocExecValue.sadd acc [id] v) ctx_s s
   in
   let ctx_ref = ref (SocExecValue.create_ctx soc_tbl soc) in
+  let ss_table = Hashtbl.create 10 in
   let step sl_in =
     let ctx = { !ctx_ref with s = add_subst sl_in !ctx_ref.s } in
     let ctx = SocExecDbg.do_step soc_tbl soc ctx in
@@ -97,6 +98,12 @@ let make_do argv opt =
     outputs= vntl_o;
     reset=(fun () -> ctx_ref := SocExecValue.create_ctx soc_tbl soc);
     kill=(fun _ -> if opt.outfile <> "" then (flush opt.oc; close_out opt.oc));
+    save_state = (fun i -> Hashtbl.replace ss_table i (!ctx_ref));
+    restore_state = (fun i ->
+        match Hashtbl.find_opt ss_table i with
+        | Some (x) -> ctx_ref := x
+        | None  -> Printf.eprintf "Cannot restore state %i from lv6\n" i; flush stderr 
+        );
     init_inputs=mems_in;
     init_outputs=mems_out;
     step=step;     
diff --git a/src/main.ml b/src/main.ml
index aa725e667a0cc0fe963d12f48b76ff55ecb9a74b..eb274bcf6c75fcb282a5aa5f3c327f0afc9d00a2 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 10/07/2018 (at 10:43) by Erwan Jahier> *)
+(* Time-stamp: <modified the 05/04/2019 (at 13:04) by Erwan Jahier> *)
 
 open Lv6Verbose
 open AstV6
diff --git a/src/socExecDbg.ml b/src/socExecDbg.ml
index 913ec34b796ed12680eb5b8c0835c3a6d1b395b7..dc246085272c8595b5c09d0c747c79265affcf92 100644
--- a/src/socExecDbg.ml
+++ b/src/socExecDbg.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 04/04/2019 (at 16:40) by Erwan Jahier> *)
+(* Time-stamp: <modified the 05/04/2019 (at 13:08) by Erwan Jahier> *)
 open Soc
 open Data
 open SocExecValue
@@ -117,7 +117,7 @@ let (assign_expr_dbg : Lxm.t -> SocExecValue.ctx -> var_expr -> var_expr -> Even
     let (datal:Data.subst list) =  [("rhs",val_ve_in);("lhs",val_ve_in)] in 
     let nectx = Event.incr_event_nb local_ectx in
     let nectx = Event.decr_event_depth nectx in
-    {
+    { ectx with
       Event.kind = Event.Exit;
       Event.name = "Assign";
       Event.lang = "lustre";
@@ -200,7 +200,7 @@ let (gen_access_events :
       | _,_ -> assert false
     in
     let data = (fst v_out, val_v_out)::data in
-    {
+    { ectx with
       Event.step = ectx.Event.step;
       Event.nb = nectx.Event.nb;
       Event.depth = ectx.Event.depth;
@@ -217,7 +217,7 @@ let (gen_access_events :
       Event.reset = ectx.Event.reset;
     } 
   in
-  {
+  { ectx with
     Event.step = ectx.Event.step;
     Event.nb = ectx.Event.nb;
     Event.depth = ectx.Event.depth;
@@ -436,7 +436,7 @@ and (do_gao : Soc.tbl -> Event.t -> gao -> SocExecValue.ctx ->
       let cont2 local_ectx val_ctx =
         let nectx = Event.incr_event_nb local_ectx in
         (*         let nectx = Event.decr_event_depth nectx in *)
-        {
+        { ectx with
           Event.kind = Event.Exit;
           Event.name = "when";
           Event.lang = "lustre";
@@ -581,7 +581,7 @@ and (do_soc_step : Lxm.t -> int option -> step_method -> SocExecValue.ctx ->
     let nectx = Event.incr_event_nb local_ectx in
     let nectx = Event.decr_event_depth nectx in
     let nectx = { nectx with Event.sinfo = initial_sinfo } in
-    {
+    { nectx with
       Event.step = nectx.Event.step;
       Event.nb = local_ectx.Event.nb;
       Event.depth = ectx0.Event.depth;
@@ -702,7 +702,7 @@ and (do_step_dbg : Soc.tbl -> Soc.t -> Event.t -> SocExecValue.ctx ->
                   Event.depth = ectx.Event.depth-1;
                 }
     in
-    { 
+    { ectx with
       Event.step = ectx.Event.step;
       Event.nb = local_ectx.Event.nb;
       Event.depth = ectx.Event.depth;
@@ -719,7 +719,7 @@ and (do_step_dbg : Soc.tbl -> Soc.t -> Event.t -> SocExecValue.ctx ->
       Event.reset = ectx.Event.reset;
     } 
   in
-  { 
+  { ectx with
     Event.step = ectx.Event.step;
     Event.nb = ectx.Event.nb;
     Event.depth = ectx.Event.depth;
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index bb731a0fb00842978383cf232aaad9bdc60d6968..a0b81938c360c79e4a0d394d0582ba9c8914d5c8 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,5 +1,5 @@
 ==> lus2lic0.sum <==
-Test run by jahier on Thu Apr  4 16:42:01 
+Test run by jahier on Wed Apr 10 10:15:00 
 Native configuration is x86_64-pc-linux-gnu
 
 		=== lus2lic0 tests ===
@@ -66,7 +66,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
 XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
 
 ==> lus2lic1.sum <==
-Test run by jahier on Thu Apr  4 16:42:02 
+Test run by jahier on Wed Apr 10 10:15:01 
 Native configuration is x86_64-pc-linux-gnu
 
 		=== lus2lic1 tests ===
@@ -409,7 +409,7 @@ PASS: sh multipar.sh
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus  {}
 
 ==> lus2lic2.sum <==
-Test run by jahier on Thu Apr  4 16:42:22 
+Test run by jahier on Wed Apr 10 10:15:27 
 Native configuration is x86_64-pc-linux-gnu
 
 		=== lus2lic2 tests ===
@@ -749,7 +749,7 @@ PASS: sh zzz2.sh
 PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus  {}
 
 ==> lus2lic3.sum <==
-Test run by jahier on Thu Apr  4 16:42:46 
+Test run by jahier on Wed Apr 10 10:15:55 
 Native configuration is x86_64-pc-linux-gnu
 
 		=== lus2lic3 tests ===
@@ -1259,7 +1259,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
 
 
 ==> lus2lic4.sum <==
-Test run by jahier on Thu Apr  4 16:43:24 
+Test run by jahier on Wed Apr 10 10:16:35 
 Native configuration is x86_64-pc-linux-gnu
 
 		=== lus2lic4 tests ===
@@ -1777,13 +1777,13 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
 ===============================
 # Total number of failures: 15
 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
-lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 20 seconds
-lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 24 seconds
-lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 38 seconds
+lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 26 seconds
+lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 28 seconds
+lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 40 seconds
 lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 15 seconds
 * Ref time: 
-50.01user 17.29system 1:38.20elapsed 68%CPU (0avgtext+0avgdata 280776maxresident)k
-0inputs+143136outputs (0major+11028321minor)pagefaults 0swaps
+55.29user 23.22system 1:49.89elapsed 71%CPU (0avgtext+0avgdata 280904maxresident)k
+0inputs+143264outputs (0major+15390166minor)pagefaults 0swaps
 * Quick time (-j 4):
-60.40user 19.49system 0:53.88elapsed 148%CPU (0avgtext+0avgdata 280080maxresident)k
-8456inputs+139416outputs (4major+10787022minor)pagefaults 0swaps
+63.75user 25.55system 1:10.19elapsed 127%CPU (0avgtext+0avgdata 280964maxresident)k
+3936inputs+141656outputs (1major+15214675minor)pagefaults 0swaps