diff --git a/src/core/js/caosdb.js b/src/core/js/caosdb.js
index 010a04761981cdd0ff918a3a6f6fa43d7e8872b2..d673c9198cef6d41bfd19c5d5f618e13d20f0a02 100644
--- a/src/core/js/caosdb.js
+++ b/src/core/js/caosdb.js
@@ -404,12 +404,13 @@ function getIDfromHREF(el) {
 
 /**
  * Return an entity heading attribute from an element.
+ *
  * @param element The element holding the entity.
  * @return The value of the entity heading attribute or undefined if it is not present.
  */
 function getEntityHeadingAttribute(element, attribute_name) {
-    var res = element.getElementsByClassName("caosdb-entity-heading-attr");
-
+    var res = findElementByConditions(element, x => x.classList.contains("caosdb-entity-heading-attr"),
+                                      x => x.classList.contains("caosdb-preview-container"));
     for (var i = 0; i < res.length; i++) {
         var subres = res[i].getElementsByClassName("caosdb-entity-heading-attr-name");
         if (subres.length != 1) {
@@ -444,7 +445,6 @@ function getEntityDescription(element) {
  * @return A list of objects with name and id of the parents.
  */
 function getParents(element) {
-    // var res = element.getElementsByClassName("caosdb-parent-name");
     var res = findElementByConditions(element, x => x.classList.contains("caosdb-parent-name"),
                     x => x.classList.contains("caosdb-preview-container"));
     var list = [];