diff --git a/frontend-js/src/main/js/gui/topMenu/TopMenu.js b/frontend-js/src/main/js/gui/topMenu/TopMenu.js
index c2b5122a992dd59aa44676d0b0a7a55014ef2f30..7c3bd40e8ecb2b304e874960ee8867b7098e6fbd 100644
--- a/frontend-js/src/main/js/gui/topMenu/TopMenu.js
+++ b/frontend-js/src/main/js/gui/topMenu/TopMenu.js
@@ -31,7 +31,6 @@ TopMenu.prototype._createGui = function() {
   self.getElement().appendChild(overviewDialogDiv);
   self.setControlElement(PanelControlElementType.OVERVIEW_DIALOG_DIV, overviewDialogDiv);
 
-
   var hideButtonDiv = Functions.createElement({
     type : "div",
     className : "headerHideDivButton"
@@ -56,7 +55,7 @@ TopMenu.prototype._createGui = function() {
 
   var versionDiv = Functions.createElement({
     type : "div",
-    className: "headerTextBold",
+    className : "headerTextBold",
     name : "versionDiv"
   });
   self.getElement().appendChild(versionDiv);
@@ -184,8 +183,7 @@ TopMenu.prototype.init = function() {
   var clearButton = self.getControlElement(PanelControlElementType.MENU_CLEAR_BUTTON);
   clearButton.onclick = (function() {
     return function() {
-      self.getMap().clearDbOverlays();
-      return false;
+      return self.getMap().clearDbOverlays();
     };
   })();
 
diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js
index c3b9f9037c3711e58969133e87d16f372d3e4169..78bd410fbc22c8af9ecf9f57b53a43e6f7178bd9 100644
--- a/frontend-js/src/main/js/map/CustomMap.js
+++ b/frontend-js/src/main/js/map/CustomMap.js
@@ -137,12 +137,14 @@ CustomMap.prototype.createLogo = function() {
  * Clear all AbstractDbOverlay.
  */
 CustomMap.prototype.clearDbOverlays = function() {
+  var promises = [];
   for ( var overlayName in this.overlayCollections) {
     if (this.overlayCollections.hasOwnProperty(overlayName)) {
       var collection = this.overlayCollections[overlayName];
-      collection.clear();
+      promises.push(collection.clear());
     }
   }
+  return Promise.all(promises);
 };
 
 /**
diff --git a/frontend-js/src/test/js/map/CustomMap-test.js b/frontend-js/src/test/js/map/CustomMap-test.js
index 643a667cb5f6181e6b02bbf09c72d6cb48c34c29..685f4db8cd1660bd1164e7f38195f4e8167d7e1b 100644
--- a/frontend-js/src/test/js/map/CustomMap-test.js
+++ b/frontend-js/src/test/js/map/CustomMap-test.js
@@ -441,25 +441,31 @@ describe('CustomMap', function() {
       type : "POINT",
       icon : "marker/empty.png"
     };
+    var searchResults = [ new IdentifiedElement(javaObj) ];
 
     oc.getIdentifiedElements = function() {
-      return Promise.resolve([ new IdentifiedElement(javaObj) ]);
+      return Promise.resolve(searchResults);
     };
+    oc.clear = function(){
+      searchResults = [];
+      return this.callListeners("onSearch",searchResults);
+    }
 
-    map.renderOverlayCollection({
+    return map.renderOverlayCollection({
       overlayCollection : oc
-    });
-
-    map.clearDbOverlays();
+    }).then(function() {
 
-    var markerCount = 0;
-    for ( var id in oc.pointMarkers) {
-      if (oc.pointMarkers.hasOwnProperty(id)) {
-        markerCount++;
+      return map.clearDbOverlays();
+    }).then(function() {
+      var markerCount = 0;
+      for ( var id in oc.pointMarkers) {
+        if (oc.pointMarkers.hasOwnProperty(id)) {
+          markerCount++;
+        }
       }
-    }
 
-    assert.equal(0, markerCount);
+      assert.equal(0, markerCount);
+    });
 
   });