diff --git a/src/code_.py b/src/code_.py
index ce88418b5b22fc9adab0259d4c42abbea564a086..0213fc4f9735d775c34b3bc6fa2c673b7dcb6f79 100644
--- a/src/code_.py
+++ b/src/code_.py
@@ -137,7 +137,7 @@ class Code:
             #TODO -> do the same with flatMap -> 668
             for word in ["map", "flatMap"]:
                 for end_char in ['{', '\(']:
-                    pattern = fr"\.\s*"+word+r"\s*"+end_char
+                    pattern = fr"(\.|\|)\s*"+word+r"\s*"+end_char
                     for match in re.finditer(pattern, code):
                         start_map, end = match.span(0)
                         if(end_char=="{"):
diff --git a/src/workflow.py b/src/workflow.py
index 976170dbd3935b9f2cc374515eda43580b0dcc7f..724d5a1f53ae710136e6d0a1411ee7f918fffba0 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -1079,7 +1079,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                 code = self.simplify_workflow_code()
                 self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs)
                     
-            
+            if(len(self.get_processes_called())==0):
+                raise BioFlowInsightError("There are no process calls in the workflow. BioFlow-Insight cannot rewrite the workflow in this case.", type="Rewrite Error")
+
             #DETERMING WHICH SUBWORKFLOWS ARE BROKEN WITH THE CLUSTER
             def get_clusters_with_calls(clusters):
                 #Creating the clusters with calls instead of processes or subworkflows