diff --git a/src/graph.py b/src/graph.py
index d132cd50576a871b6363bb76462ab9fe43117ee9..a06890ff0de98a98570ca61194711f459af9943c 100644
--- a/src/graph.py
+++ b/src/graph.py
@@ -320,6 +320,7 @@ class Graph():
             
         
         #if(self.workflow.get_duplicate_status()):
+        #    print("here")
         if(False):#Right now not generating the colored edges
             checking_conditions = True
             most_influential_conditions = self.workflow.get_most_influential_conditions()
@@ -813,6 +814,11 @@ class Graph():
     #    with open(self.get_output_dir() / "graphs/metadata_graph_wo_operations.json", 'w') as output_file :
     #        json.dump(dico, output_file, indent=4)
 
+    def get_number_weakly_connected_components_in_process_dependency_graph(self):
+        G = self.get_networkx_graph(self.dico_process_dependency_graph, None)
+        weakly_connected_components = list(nx.weakly_connected_components(G))
+        return len(weakly_connected_components)
+
     def get_topogical_order(self, clusters):
         #if(self.get_process_dependency_graph_dico()=={}):
         #    self.intialise_process_dependency_graph()  
diff --git a/src/workflow.py b/src/workflow.py
index bce20cb4684e23088b2ee8d99c66d86519e07bcb..bb2575f1ca2df3b802f18c869effc967679f4264 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -1207,6 +1207,11 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                 else:
                     #This means that the subworkflow is broken
                     broken_subworkflows.append(sub)
+            if(broken_subworkflows==[]):
+                #TODO need to update that so that the rewritte is done locally in the subworkflows and not at the level of the entire workflow
+                #See x-kiana/nextflow_pipeline for a good example
+                if(self.graph.get_number_weakly_connected_components_in_process_dependency_graph()>1):
+                    return list(subworkflow_2_executors.keys())
             return broken_subworkflows
             
         #Get the clusters and the code