diff --git a/examples/example4/template/test.html b/examples/example4/template/test.html
index 4c239f9dcc27309c8333ba32525a7a565dcf55e5..794b0ec13831b3627bf891eae915e48f414b89a0 100644
--- a/examples/example4/template/test.html
+++ b/examples/example4/template/test.html
@@ -49,7 +49,7 @@
     </header>
 
     <monster-state>
-      <a href="mmmm" data-attributes="href path:anchors.mmmm.href,title path:anchors.mmmm.title,hreflang path:anchors.mmmm.hreflang" data-bob-reference="mmmm"><img width="16" height="16" alt="tick" title="yes" src="data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYYDJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2Cm
+      <a href="mmmm" data-attributes="title path:anchors.mmmm.title,href path:anchors.mmmm.href,hreflang path:anchors.mmmm.hreflang" data-bob-reference="mmmm"><img width="16" height="16" alt="tick" title="yes" src="data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYYDJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2Cm
   V1unU4zPgI/Sg6DJnJ3ImTh8Mtbs00aNP1CZSGy0YqLEn47RgXW8amasW7XWsmmvX2iuXiwAAAAAEAAQAAAFVyAgjmRpnihqGCkpDQ
   PbGkNUOFk6DZqgHCNGg2T4QAQBoIiRSAwBE4VA4FACKgkB5NGReASFZEmxsQ0whPDi9BiACYQAInXhwOUtgCUQoORFCGt/g4QAIQA7" id="tickyesdata-image-gi-4013311193" data-bob-reference="tickyesdata-image-gi-3753669760" data-attributes="src path:content.tickyesdata-image-gi-3753669760.src,alt path:content.tickyesdata-image-gi-3753669760.alt,title path:content.tickyesdata-image-gi-3753669760.title"/></a>
       <h1 class="deco"><span data-bob-reference="bad-request" data-replace-self="path:text.bad-request.text">Bad Request</span></h1>
@@ -99,6 +99,7 @@
         <div data-monster-head="channel order number" data-monster-replace="path:datatable-order-list-row.channelOrderID" data-bob-reference="channel-order-number" data-attributes="data-monster-head path:text.channel-order-number.text"></div>
         <div data-monster-head="resubmissionDate" data-monster-mode="hidden" data-bob-reference="resubmission-date" data-attributes="data-monster-head path:text.resubmission-date.text"></div>
         <div data-monster-head="payment type" data-monster-replace="path:datatable-order-list-row.localStrings.paymentType" data-bob-reference="payment-type" data-attributes="data-monster-head path:text.payment-type.text"></div>
+        <div data-monster-head=" " data-monster-replace="path:datatable-order-list-row.localStrings.paymentType" data-attributes="data-monster-head path:text.payment-type.text"></div>
       </template>
     </monster-datatable>
   
diff --git a/source/template/prepare.go b/source/template/prepare.go
index 4f55c2b98c7cf1a8fa3af9ca1b2f1a8a06c6bc76..de3624cb9c714b85c39d98ed70194a28e621d410 100644
--- a/source/template/prepare.go
+++ b/source/template/prepare.go
@@ -554,7 +554,21 @@ func checkMonsterDatatableHead(n *html.Node, storage *types.PageData) {
 
 	for _, div := range list {
 
+		for i, attr := range div.Attr {
+			if attr.Key == constants.DataBobReferenceAttributeKey && attr.Val == "" {
+				div.Attr = append(div.Attr[:i], div.Attr[i+1:]...)
+			}
+		}
+
 		head := util.GetAttribute(div.Attr, "data-monster-head")
+
+		trimHead := strings.TrimSpace(head)
+
+		if trimHead == "" {
+			log.Warn("The head '" + buildLogContent(div, "") + "' has no content! Will use the content of the head as a key.")
+			continue
+		}
+
 		logContent := buildLogContent(div, head)
 
 		id := util.GetOrCreateReference(div, head)