diff --git a/src/outils_graph.py b/src/outils_graph.py
index 54cec76095dd111a4e6bf7bee9174d6e32baf192..6d237b9c6d0ae378d0659167cf3f95b1259ae5a2 100644
--- a/src/outils_graph.py
+++ b/src/outils_graph.py
@@ -141,8 +141,10 @@ def fill_dot_2(dot, dico, label_node = True, label_edge = True):
 
 def generate_pos_graph(filename, dico, relevant_nodes = -1):
     dot = graphviz.Digraph()
+    dot.attr(rankdir='LR')
     fill_dot(dot, dico, False, False)
     dot.format = 'dot'
+    dot.render(filename=f'{filename}_pos')
     dot.render(filename=f'{filename}_pos', outfile=f'{filename}_pos.png')
     
 
diff --git a/src/workflow.py b/src/workflow.py
index 1277eda50783d26b09f664a61b5666115bafff87..fb4d4aad1a3c8b891350f27ff39949c2fa60c9be 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -667,14 +667,18 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
         for exe in all_executors:
             #We don't need to check the case call since the workflow has already been rewriteen -> emits only appear in operations
             if(exe.get_type()=="Operation"):
+                added = False
+                new = exe.get_code(get_OG = True)
                 for emited in exe.get_origins():
                     if(emited.get_type()=="Emitted"):
                         if(emited.get_emitted_by().get_first_element_called()==subworklfow):
                             if(emited.get_emits() not in emits):
                                 raise Exception("This shoudn't happen -> since it is the actual subworkflow")
-                            new = exe.get_code(get_OG = True).replace(emited.get_code(), emited.get_emits().get_origins()[0].get_code())
+                            new = new.replace(emited.get_code(), emited.get_emits().get_origins()[0].get_code())
+                            added = True
                             #to_replace.append((exe.get_code(get_OG = True), f"{exe.get_gives()[0].get_code()} = {emited.get_emits().get_origins()[0].get_code()}"))
-                            to_replace.append((exe.get_code(get_OG = True), new))
+                if(added):
+                    to_replace.append((exe.get_code(get_OG = True), new))
         #This dictionnary is used to check if the replacement has already been done (in the case of dupliactes in new)
         dico_replace = {}
         for r in to_replace:
@@ -698,6 +702,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                 #code = code.replace(old, new)
                 code = replace_group1(code, fr"({re.escape(old)})[^\w]", new)
                 if(temp_code==code):
+                    #print(code)
+                    #print("old", f'"{old}"')
+                    #print("new", f'"{new}"')
                     raise Exception("Something went wrong: The code hasn't changed")
         
         return code