diff --git a/evoprompt/evolution.py b/evoprompt/evolution.py
index 6d076bf4d82b02adc952ddbb8efa624ae2801d3d..3891015aafbb4f86e26f5bac9487a1cd0e02df98 100644
--- a/evoprompt/evolution.py
+++ b/evoprompt/evolution.py
@@ -250,14 +250,18 @@ class DifferentialEvolution(EvolutionAlgorithm):
             ),
         )
         matches = re.findall(
-            # TODO make sure that regex matches also if </prompt> is missing
-            r"<prompt>(.*?)</prompt>",
+            # regex that matches any characters between last pair of <prompt></prompt>, also if </prompt> is missing
+            r"<prompt>(?!.*<prompt>)(?:(.*)</prompt>|(.*))",
             evolved_prompt,
             flags=(re.IGNORECASE | re.DOTALL),
         )
-        if matches:
-            # we expect that the last match is where we find the prompt, other matches are part of the instruction (which the model repeats)
-            evolved_prompt = matches[-1]
+        if matches and any(matches[0]):
+            # there is always only a single match, and one group should be non-empty
+            if matches[0][0]:
+                evolved_prompt = matches[0][0]
+            else:
+                assert matches[0][1]
+                evolved_prompt = matches[0][1]
         else:
             # TODO what to do in this case? Discard generated prompt directly?
             pass
diff --git a/evoprompt/template_de.py b/evoprompt/template_de.py
index 04aacd45aa12bd66469f168a7bbe36d1c05a3345..1a8cb0e3834fec400f13a6e955a78ad17e6e2f9b 100644
--- a/evoprompt/template_de.py
+++ b/evoprompt/template_de.py
@@ -102,7 +102,7 @@ def get_de_prompt_template(use_demonstration_example: bool, task: None | Task =
     if use_demonstration_example:
         assert (
             task is not None
-        ), "Task cannot be done if demonstation data should be used."
+        ), "Task cannot be None if demonstation data should be used."
 
         if isinstance(task, (TextClassification, Summarization)):
             return DE_PROMPT_WITH_DEMONSTRATION_SIM