diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py
index 0dee8239c1130597538936f64b57d75c9d8e4563..6204e1197840c4f7347697c91ecae90967e5e894 100644
--- a/src/linkahead/common/models.py
+++ b/src/linkahead/common/models.py
@@ -3284,7 +3284,7 @@ class Container(list):
 
         if add_to_element is None:
             add_to_element = etree.Element("Entities")
-        noscript_in_supplied_xml = list(add_to_element.iter("noscript"))
+        noscript_in_supplied_xml = list(add_to_element.iter("noscript", "TransactionBenchmark"))
 
         for m in self.messages:
             add_to_element.append(m.to_xml())
@@ -3301,10 +3301,12 @@ class Container(list):
                 elem = e.to_xml()
             add_to_element.append(elem)
 
-        # remove noscript elements added by this function
-        for elem in list(add_to_element.iter("noscript")):
+        # remove noscript and benchmark elements added by this function
+        for elem in list(add_to_element.iter("noscript", "TransactionBenchmark")):
             if elem not in noscript_in_supplied_xml:
-                elem.getparent().remove(elem)
+                parent = elem.getparent()
+                if parent is not None:
+                    parent.remove(elem)
 
         return add_to_element