diff --git a/src/call.py b/src/call.py
index a07dc6caff08483bea4750c406a7470f91bee0b7..0e647eb4c60bb116fbe70db2bce04cd6e8fd43b5 100644
--- a/src/call.py
+++ b/src/call.py
@@ -103,12 +103,16 @@ class Call(Executor):
                         if(temp==code):
                             raise Exception("This souldn't happen")
                         #code = code.replace(param.get_code(get_OG=True), param_new_name)
-                        lines = param.simplify_code().split('\n')
+                        simplified_param = param.simplify_code()
+                        lines = simplified_param.split('\n')
                         if(len(lines)==1):
                             new_bit = f"{param_new_name} = {lines[0]}"
                         else:
-                            head = '\n'.join(lines[:-1])
-                            new_bit = f"{head}\n{param_new_name} = {lines[-1]}"
+                            if(re.fullmatch(r"\w+", lines[-1].strip())):
+                                head = '\n'.join(lines[:-1])
+                                new_bit = f"{head}\n{param_new_name} = {lines[-1]}"
+                            else:
+                                new_bit = f"{param_new_name} = {simplified_param}"
                         temp = code
                         code = code.replace(tag_to_add, f"{tag_to_add}\n{new_bit}")
                         if(temp==code):
diff --git a/src/main.py b/src/main.py
index 63a052adb834ad40c7cde3a9215d21c3a243781a..44f7654c93743f961eb56cd277308745650838e6 100644
--- a/src/main.py
+++ b/src/main.py
@@ -15,10 +15,14 @@ class Main(Nextflow_Building_Blocks):
         self.initialised = False
         self.root = None 
 
-    def get_order_execution_executors(self, dico):
+    def get_order_execution_executors(self, dico, seen):
         executors = self.get_all_executors_in_subworkflow()
         pos = {}
         for e in executors:
+            code = e.get_code(get_OG = True)
+            if(code in seen):
+                raise BioFlowInsightError(f'Executor "{code}" appears twice in the workflow in the exact same way. BioFlow-Insight cannot rewrite the workflow then, try slighly changing how one of the executors is defined')
+            seen[code] = ''
             pos[e] = e.get_position_in_main(e)
         #TODO add sort here
         pos =  {k: v for k, v in sorted(pos.items(), key=lambda item: item[1])}
@@ -26,7 +30,7 @@ class Main(Nextflow_Building_Blocks):
             if(e.get_type()=="Call"):
                 if(e.get_first_element_called().get_type()=="Subworkflow"):
                     dico[e] = {}
-                    e.get_first_element_called().get_order_execution_executors(dico[e])
+                    e.get_first_element_called().get_order_execution_executors(dico[e], seen)
                 else:
                     dico[e.get_first_element_called()] = pos[e]
             else:
diff --git a/src/operation.py b/src/operation.py
index f58c8338dad349879432cf9b00f1d429e8402c08..ebc158aba074b4a72718378f0a0e7f5d51034c29 100644
--- a/src/operation.py
+++ b/src/operation.py
@@ -753,9 +753,9 @@ class Operation(Executor):
             to_call.append(m.get_alias())
         pattern_call = constant.BEGINNING_CALL
         searching = True        
-        text = " "+self.get_code(clean_pipe = clean_pipe)
         while(searching):
             searching= False
+            text = " "+self.get_code(clean_pipe = clean_pipe, replace_calls = False)
             for c in self.calls:
                 temp = text
                 text = text.replace(self.calls[c].get_code(), "")
diff --git a/src/workflow.py b/src/workflow.py
index 1826ab782973f1da45997b4988d4844e7b11fee4..09be46ea695a9664145a0e33dd9625a47c7a89ce 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -420,7 +420,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
     #Method that returns the order of execution for each executor
     def get_order_execution_executors(self):
         dico = {}
-        dico = self.get_workflow_main().get_order_execution_executors(dico)
+        seen = {}
+        dico = self.get_workflow_main().get_order_execution_executors(dico, seen)
         tab = []
         def explore_dico(dico):
             if(type(dico)!=dict):