diff --git a/asr/models/simple-example/automate/simple-example_dico_action.txt b/asr/models/simple-example/automate/simple-example_dico_action.txt
index 9d03b9d822a3882d191b0a77968d6bca1c571f3c..911ee7e1a07748462ea7b4a263258d0749ac115d 100644
--- a/asr/models/simple-example/automate/simple-example_dico_action.txt
+++ b/asr/models/simple-example/automate/simple-example_dico_action.txt
@@ -2,15 +2,16 @@
 <joker> 1
 change_section(1,"example1","go_to_section_one") 2
 change_section(0,"example2","exit_section") 3
-action(1,1,0,"example1","futures") 4
-action(1,1,1,"example2","hidden_in_details") 5
-action(1,1,2,"him","the_architect") 6
-action(1,1,3,"action3","tossed_over") 7
-action(1,1,4,"#ENDSEQUENCE(1)","") 8
-action(1,1,4,"#ENDSECTION(1)","") 9
-change_section(0,"close","") 10
+change_section(0,"example2","") 4
+action(1,1,0,"example1","futures") 5
+action(1,1,1,"example2","hidden_in_details") 6
+action(1,1,2,"him","the_architect") 7
+action(1,1,3,"action3","tossed_over") 8
+action(1,1,4,"#ENDSEQUENCE(1)","") 9
+action(1,1,4,"#ENDSECTION(1)","") 10
 change_section(2,"example3","open_section_two") 11
 change_section(0,"example4","exit_section") 12
-action(2,1,4,"action4","life") 13
-action(2,1,5,"#ENDSEQUENCE(1)","") 14
-action(2,1,6,"#ENDSECTION(2)","") 15
+change_section(0,"example4","") 13
+action(2,1,4,"action4","life") 14
+action(2,1,5,"#ENDSEQUENCE(1)","") 15
+action(2,1,6,"#ENDSECTION(2)","") 16
diff --git a/asr/models/simple-example/automate/simple-example_section1.fst b/asr/models/simple-example/automate/simple-example_section1.fst
index 2478b3e6e948d9b3b107da9a7004c71e89674c01..32673adcfb28b250bf1ba2ad1c98707922ab701a 100644
Binary files a/asr/models/simple-example/automate/simple-example_section1.fst and b/asr/models/simple-example/automate/simple-example_section1.fst differ
diff --git a/asr/models/simple-example/automate/simple-example_section1.txt b/asr/models/simple-example/automate/simple-example_section1.txt
index 42749392161445fa5f23bb2a43a2229e8eb9bfec..2064e77d5d1654ff6a9d18ca2cdc6896b5dda519 100644
--- a/asr/models/simple-example/automate/simple-example_section1.txt
+++ b/asr/models/simple-example/automate/simple-example_section1.txt
@@ -1,22 +1,22 @@
-0	1	futures	4	0
+0	1	futures	5	0
 1	100
-0	1	<joker>	4	100
-1	2	hidden	5	0
+0	1	<joker>	5	100
+1	2	hidden	6	0
 2	3	in	0	0
 2	3	<epsilon>	0	10
 3	4	details	0	0
 4	100
-1	4	<joker>	5	100
-4	5	the	6	0
+1	4	<joker>	6	100
+4	5	the	7	0
 5	6	architect	0	0
 6	100
-4	6	<joker>	6	100
-6	7	tossed	7	0
+4	6	<joker>	7	100
+6	7	tossed	8	0
 7	8	over	0	0
 8	100
-6	8	<joker>	7	100
-8	9	<epsilon>	8	0
+6	8	<joker>	8	100
+8	9	<epsilon>	9	0
 9	100
-9	10	<epsilon>	9	0
-10	11	<epsilon>	10	0
+9	10	<epsilon>	10	0
+10	11	<epsilon>	4	0
 11
diff --git a/asr/models/simple-example/automate/simple-example_section2.fst b/asr/models/simple-example/automate/simple-example_section2.fst
index 1b8663365d32aeb7a911e95b1156aca0ffe09c44..a18c933e1fcb950472d67483cbe1696416e0643f 100644
Binary files a/asr/models/simple-example/automate/simple-example_section2.fst and b/asr/models/simple-example/automate/simple-example_section2.fst differ
diff --git a/asr/models/simple-example/automate/simple-example_section2.txt b/asr/models/simple-example/automate/simple-example_section2.txt
index b17ea96785055a9d86f9bec769fce4911ebee052..c246a307d1808a6dd217942d115d59c0a7eef402 100644
--- a/asr/models/simple-example/automate/simple-example_section2.txt
+++ b/asr/models/simple-example/automate/simple-example_section2.txt
@@ -1,9 +1,9 @@
-0	1	<epsilon>	9	0
-1	2	life	13	0
+0	1	<epsilon>	10	0
+1	2	life	14	0
 2	100
-1	2	<joker>	13	100
-2	3	<epsilon>	14	0
+1	2	<joker>	14	100
+2	3	<epsilon>	15	0
 3	100
-3	4	<epsilon>	15	0
-4	5	<epsilon>	10	0
+3	4	<epsilon>	16	0
+4	5	<epsilon>	13	0
 5
diff --git a/asr/tools/slu/src/process_xml_for_slu b/asr/tools/slu/src/process_xml_for_slu
index 93feb1c7b38052d4db2ce03dfa989936eb23c156..2dff49a4f5a71069fa1e07043eeb6a368d6a8016 100755
Binary files a/asr/tools/slu/src/process_xml_for_slu and b/asr/tools/slu/src/process_xml_for_slu differ
diff --git a/asr/tools/slu/src/process_xml_for_slu.c b/asr/tools/slu/src/process_xml_for_slu.c
index dc919f0dca3a9bc39d3222b2af7324eff6cd20c0..d8c639e4d672f16fe98f7a7045e2c11b88916e5b 100644
--- a/asr/tools/slu/src/process_xml_for_slu.c
+++ b/asr/tools/slu/src/process_xml_for_slu.c
@@ -91,10 +91,12 @@ char *get_field(char *ch, char *attribut, char *chfield)
 {
 int i,j;
 chfield[0]='\0';
-for(i=0;(ch[i])&&((ch[i]!=' ')||(strncmp(ch+i+1,attribut,strlen(attribut)))||(ch[i+1+strlen(attribut)]!='='));i++);
+for(i=0;(ch[i])&&((ch[i]!=' ')||(strncmp(ch+i+1,attribut,strlen(attribut)))||((ch[i+1+strlen(attribut)]!='=')&&(ch[i+1+strlen(attribut)]!=' ')));i++);
 if (ch[i])
  {
- for(j=0,i=i+1+strlen(attribut)+2;(ch[i])&&(ch[i]!='"');i++,j++) chfield[j]=ch[i];
+ for(i+=1+strlen(attribut);(ch[i])&&(ch[i]!='=');i++); if (!ch[i]) ERREUR("bad format in :",ch);
+ for(++i;(ch[i])&&(ch[i]!='"');i++); if (!ch[i]) ERREUR("bad format in :",ch);
+ for(j=0,i++;(ch[i])&&(ch[i]!='"');i++,j++) chfield[j]=ch[i];
  if (ch[i]!='"') ERREUR("bad format1:",ch);
  chfield[j]='\0';
  }
@@ -128,7 +130,8 @@ for(i=0;ch[i];i++) if (ch[i]==' ') ch[i]='_';
 
 int main(int argc, char **argv)
 {
-int nbsection,i,j,k,nb,ordre,repetition,nbseq,actionsection,actionsequence,currentstate,statedebseq,action,findend,t_end[MAX_END_STATE],nbend,idac,actionfinsection,currentstatevoid;
+int nbsection,i,j,k,nb,ordre,repetition,nbseq,actionsection,actionsequence,currentstate,statedebseq,action,findend,t_end[MAX_END_STATE],nbend,idac,
+	actionfinsection,actionfinsectionimplicit,currentstatevoid;
 FILE *file,*filevoid,*fileexit;
 char *pt,ch[TailleLigne],*t_field[MAX_FIELD],*chprefix,chname[TailleLigne],chfield[TailleLigne],chcontent[TailleLigne],ch2[TailleLigne];
 
@@ -156,7 +159,7 @@ if (!(filevoid=fopen(ch,"wt"))) ERREUR("can't write in:",ch);
 fprintf(filevoid,"0\n");
 
 currentstatevoid=0;
-ordre=STRICT; repetition=False; file=NULL; actionsection=0; findend=False; nbend=0; nbseq=0; actionfinsection=0;
+ordre=STRICT; repetition=False; file=NULL; actionsection=0; findend=False; nbend=0; nbseq=0; actionfinsection=actionfinsectionimplicit=0;
 for(idac=nbsection=0;fgets(ch,TailleLigne,stdin);)
  {
  if (strstr(ch,"<section"))
@@ -172,11 +175,10 @@ for(idac=nbsection=0;fgets(ch,TailleLigne,stdin);)
     {
     sprintf(chcontent,"action(%d,%d,%d,\"#ENDSEQUENCE(%d)\",\"\")",nbsection,nbseq,idac,nbseq); actionsequence=from_action_to_index(chcontent);
     sprintf(chcontent,"action(%d,%d,%d,\"#ENDSECTION(%d)\",\"\")",nbsection,nbseq,idac,nbsection); actionsection=from_action_to_index(chcontent);
-    sprintf(chcontent,"change_section(0,\"close\",\"\")"); actionfinsection=from_action_to_index(chcontent);
     for(i=0;i<nbend;i++) fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",t_end[i],currentstate+1,actionsequence);
     fprintf(file,"%d\t%d\n",currentstate+1,PENALEND); /* in order to quit on ANY action */
     fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",currentstate+1,currentstate+2,actionsection);
-    fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",currentstate+2,currentstate+3,actionfinsection);
+    fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",currentstate+2,currentstate+3,actionfinsectionimplicit);
     fprintf(file,"%d\n",currentstate+3);
     currentstate+=2;
     nbend=0;
@@ -185,7 +187,7 @@ for(idac=nbsection=0;fgets(ch,TailleLigne,stdin);)
    }
   nbseq=0; currentstate=0; //idac=0;
   get_field(ch,"id",chfield);
-  if (sscanf(chfield,"%d",&nbsection)!=1) ERREUR("bad value:",chfield);
+  if (sscanf(chfield,"%d",&nbsection)!=1) ERREUR("bad value:",ch);
   sprintf(ch2,"%s_section%s.txt",chprefix,chfield);
   if (!(file=fopen(ch2,"wt"))) ERREUR("can't write in:",ch2);
   /* we look for the "start" field */
@@ -208,9 +210,8 @@ for(idac=nbsection=0;fgets(ch,TailleLigne,stdin);)
   if (!(fileexit=fopen(ch2,"wt"))) ERREUR("can't write in:",ch2);
   get_field(ch,"action_end",chfield); if (!chfield[0]) { fprintf(stderr,"ERREUR: no action_end field in section: %d\n",nbsection); exit(0); }
   get_field(ch,"end",chcontent); if (!chcontent[0]) { fprintf(stderr,"ERREUR: no end field in section: %d\n",nbsection); exit(0); }
-  sprintf(ch2,"change_section(0,\"%s\",\"%s\")",chfield,chcontent);
-  remove_space(ch2);
-  actionfinsection=from_action_to_index(ch2);
+  sprintf(ch2,"change_section(0,\"%s\",\"%s\")",chfield,chcontent); remove_space(ch2); actionfinsection=from_action_to_index(ch2);
+  sprintf(ch2,"change_section(0,\"%s\",\"\")",chfield); remove_space(ch2); actionfinsectionimplicit=from_action_to_index(ch2);
   for(i=1,t_field[0]=strtok(chcontent," ");t_field[i-1];i++) t_field[i]=strtok(NULL," ");
   for(i=0;t_field[i];i++)
    {
@@ -299,11 +300,10 @@ if ((file)&&(nbseq>0))
   {
   sprintf(chcontent,"action(%d,%d,%d,\"#ENDSEQUENCE(%d)\",\"\")",nbsection,nbseq,idac++,nbseq); actionsequence=from_action_to_index(chcontent);
   sprintf(chcontent,"action(%d,%d,%d,\"#ENDSECTION(%d)\",\"\")",nbsection,nbseq,idac++,nbsection); actionsection=from_action_to_index(chcontent);
-  sprintf(chcontent,"change_section(0,\"close\",\"\")"); actionfinsection=from_action_to_index(chcontent);
   for(i=0;i<nbend;i++) fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",t_end[i],currentstate+1,actionsequence);
   fprintf(file,"%d\t%d\n",currentstate+1,PENALEND); /* in order to quit on ANY action */
   fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",currentstate+1,currentstate+2,actionsection);
-  fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",currentstate+2,currentstate+3,actionfinsection);
+  fprintf(file,"%d\t%d\t<epsilon>\t%d\t0\n",currentstate+2,currentstate+3,actionfinsectionimplicit);
   fprintf(file,"%d\n",currentstate+3);
   }
  }
diff --git a/main.py b/main.py
index e9bc4e3c25627fd53df329ac68af2600cc0fec2e..ce64ed7affc2f1eaccda2898c8873169620dbef2 100644
--- a/main.py
+++ b/main.py
@@ -55,9 +55,9 @@ class ScriptedASR(Gtk.Window):
         vbox.pack_start(self.asr, False, True, 5)
 
         # slu
-        #self.fake_asr = Gtk.Entry()
-        #self.fake_asr.connect('key-press-event', self.simulate_asr)
-        #vbox.pack_start(self.fake_asr, False, True, 5)
+        self.fake_asr = Gtk.Entry()
+        self.fake_asr.connect('key-press-event', self.simulate_asr)
+        vbox.pack_start(self.fake_asr, False, True, 5)
 
         slu_prefix = config_dict['slu_prefix']
         slu_actions = config_dict['slu_actions']
@@ -136,10 +136,10 @@ class ScriptedASR(Gtk.Window):
     def set_section(self, section_id):
         self.xmlview.set_section(section_id)
 
-    #def simulate_asr(self, widget, event):
-    #    if event.keyval == Gdk.KEY_Return:
-    #        text = widget.get_text()
-    #        print 'foo', text
+    def simulate_asr(self, widget, event):
+        if event.keyval == Gdk.KEY_Return:
+            text = widget.get_text()
+            self.hyp_changed([text.strip()])
 
     def slu_finished(self, model, slu_output):
         #slu_output = str(slu_output)
@@ -150,6 +150,9 @@ class ScriptedASR(Gtk.Window):
 
         #for action_id in range(0, len(self.slu_actions)):
         for action_id in range(len(self.kept_actions), len(self.slu_actions)):
+            if action_id > len(self.slu_actions) - 1:
+                print "WARNING: spurious action", action_id
+                continue
             print 'NEW ACTION:', action_id, self.slu_actions[action_id]
             action = actions.parse_slu_action(self.slu_actions[action_id])
             if action.name.startswith('#ENDSEQUENCE('):
@@ -172,6 +175,7 @@ class ScriptedASR(Gtk.Window):
                 self.kept_actions = []
                 if new_section in self.slu:
                     self.slu[new_section].reset_slu()
+                actions.perform_action(action, False)
             else:
                 actions.perform_action(action, False)
         self.kept_history = self.slu_output
diff --git a/xmlview.py b/xmlview.py
index 2a32cc3e6ff3725319cf777eb99013d4aea7ed99..89ccdb34e712ee24d3e0ee6008df07388c203030 100644
--- a/xmlview.py
+++ b/xmlview.py
@@ -144,6 +144,7 @@ class Keyword(Gtk.Label):
 
     def set_num(self, num):
         self.num = num
+        #self.set_markup(self.text + ' [<a href="%s">%s (%d)</a>] ' % (self.action, self.action, self.num))
 
     def link_clicked(self, widget, uri):
         actions.perform_action(actions.Action(uri, keyword=widget), False)