diff --git a/scripts/Infrastructure/Template.py b/scripts/Infrastructure/Template.py
index a279c5d27fdb7812444334b3f6a873dd2b9707c0..90b02b82b1c993f1ecf1b9650fdaac4c64748b8e 100644
--- a/scripts/Infrastructure/Template.py
+++ b/scripts/Infrastructure/Template.py
@@ -381,7 +381,7 @@ class TemplateManager:
                 old_instruction = [old_instruction]
             idxs_to_replace = self.__get_instruction_index(old_instruction)
 
-        if len(idxs_to_replace) == len(new_instruction_list):
+        if len(idxs_to_replace) != len(new_instruction_list):
             raise ValueError("Number of instructions to Replace does not match number of given instructions")
 
         for (index, replacement) in zip(idxs_to_replace, new_instruction_list):
diff --git a/scripts/Infrastructure/TemplateFactory.py b/scripts/Infrastructure/TemplateFactory.py
index 692b456e0c5a0f0594203bbc6d5c8c9b567468d7..06c0e04b1d1fbbe38666a75b58814a0cdf3307aa 100644
--- a/scripts/Infrastructure/TemplateFactory.py
+++ b/scripts/Infrastructure/TemplateFactory.py
@@ -159,6 +159,21 @@ def get_send_recv_template(send_func: str = "mpi_isend", recv_func: str | typing
     return tm
 
 
+def get_invalid_param_p2p_case(param, value, check_receive, send_func, recv_func):
+    tm = get_send_recv_template(send_func, recv_func)
+
+    rank = 1
+    if check_receive:
+        rank = 0
+
+    for call in tm.get_instruction(identifier="MPICALL", return_list=True):
+        if call.get_rank_executing() == rank:
+            assert call.has_arg(param)
+            call.set_arg(param, value)
+
+    return tm
+
+
 def get_collective_template(collective_func, seperate=True):
     """
     Contructs a default template for the given mpi collecive
diff --git a/scripts/main.py b/scripts/main.py
index 80879720149cb9066c56bf62514ba90aa25e1b58..d1358b9fc0a513f8e856aaddad107773508d34fe 100644
--- a/scripts/main.py
+++ b/scripts/main.py
@@ -6,8 +6,8 @@ from scripts.Infrastructure.GeneratorManager import GeneratorManager
 if __name__ == "__main__":
     gencodes_dir = "../gencodes/"
 
-    gm = GeneratorManager("./errors")
-    # gm = GeneratorManager("./errors/devel")
+    #gm = GeneratorManager("./errors")
+    gm = GeneratorManager("./errors/devel")
 
     # remove all testcases from previous execution (ease of debugging)
     for root, dirs, files in os.walk(gencodes_dir):