diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js
index a96b5c7403fe74b955febe8b24ddc96cfa706b37..2d9dbed0984afb6e1e046cb2cd6ffa3e46ac43b5 100644
--- a/frontend-js/src/main/js/map/CustomMap.js
+++ b/frontend-js/src/main/js/map/CustomMap.js
@@ -709,6 +709,7 @@ CustomMap.prototype.createMapChangedCallbacks = function() {
  * @returns submodel (or this model) with given identfier of the model
  */
 CustomMap.prototype.getSubmodelById = function(identifier) {
+  identifier = parseInt(identifier);
   if (this.getId() === identifier) {
     return this;
   }
@@ -717,6 +718,7 @@ CustomMap.prototype.getSubmodelById = function(identifier) {
       return this.submaps[i];
     }
   }
+  logger.debug("Cannot find model ", typeof(identifier));
   return null;
 };
 
@@ -1362,8 +1364,8 @@ CustomMap.prototype.renderOverlayCollection = function(overlayCollection, fitBou
         overlayCollection.aliasMarkers[element.getId()] = aliasMarker;
         if (!missingElements) {
           bounds = aliasMarker.getBounds();
-          boundsArray[element.modelId].extend(bounds.getNorthEast());
-          boundsArray[element.modelId].extend(bounds.getSouthWest());
+          boundsArray[element.getModelId()].extend(bounds.getNorthEast());
+          boundsArray[element.getModelId()].extend(bounds.getSouthWest());
         }
       }
     } else if (element.type === "REACTION") {
@@ -1389,8 +1391,8 @@ CustomMap.prototype.renderOverlayCollection = function(overlayCollection, fitBou
       overlayCollection.reactionMarkers[element.getId()] = marker;
       if (!missingElements) {
         bounds = marker.getBounds();
-        boundsArray[element.modelId].extend(bounds.getNorthEast());
-        boundsArray[element.modelId].extend(bounds.getSouthWest());
+        boundsArray[element.getModelId()].extend(bounds.getNorthEast());
+        boundsArray[element.getModelId()].extend(bounds.getSouthWest());
 
       }
     } else if (element.type === "POINT") {
@@ -1399,8 +1401,8 @@ CustomMap.prototype.renderOverlayCollection = function(overlayCollection, fitBou
       overlayCollection.pointMarkers[pointData.getId()] = pointMarker;
       if (!missingElements) {
         bounds = pointMarker.getBounds();
-        boundsArray[element.modelId].extend(bounds.getNorthEast());
-        boundsArray[element.modelId].extend(bounds.getSouthWest());
+        boundsArray[element.getModelId()].extend(bounds.getNorthEast());
+        boundsArray[element.getModelId()].extend(bounds.getSouthWest());
       }
     } else {
       logger.warn("Unknown type of the element in overlay: " + element.type);
diff --git a/frontend-js/src/main/js/map/data/IdentifiedElement.js b/frontend-js/src/main/js/map/data/IdentifiedElement.js
index e133a1d848681094205437161663cc3d3a1df43c..193a27d37289d4d85a9153694970c6655de3b31e 100644
--- a/frontend-js/src/main/js/map/data/IdentifiedElement.js
+++ b/frontend-js/src/main/js/map/data/IdentifiedElement.js
@@ -104,7 +104,7 @@ IdentifiedElement.prototype.setId = function(id) {
 };
 
 IdentifiedElement.prototype.getModelId = function() {
-  return this.id;
+  return this.modelId;
 };
 
 IdentifiedElement.prototype.setModelId = function(modelId) {
diff --git a/frontend-js/src/test/js/map/CustomMap-test.js b/frontend-js/src/test/js/map/CustomMap-test.js
index 04839edb3d74d997f8fc36f0ff1122508a311533..a859b47a6c4fedd7b915fef02d6c6bbe48699ee8 100644
--- a/frontend-js/src/test/js/map/CustomMap-test.js
+++ b/frontend-js/src/test/js/map/CustomMap-test.js
@@ -28,18 +28,32 @@ describe('CustomMap', function() {
     var map = new CustomMap(options);
     assert.ok(map);
   });
-  
-  it("customizeGoogleMapView", function() {
+
+  it("contructor", function() {
+    var options = helper.createCustomMapOptions();
+    var map = new CustomMap(options);
+    assert.ok(map);
+  });
+
+  it("getSubmodelById", function() {
     var map = helper.createCustomMap();
-    map.customizeGoogleMapView();
+    assert.ok(map.getSubmodelById(map.getId()));
   });
-  
+
+  it("getSubmodelById (invalid)", function() {
+    var map = helper.createCustomMap();
+    assert.equal(map.getSubmodelById(-1), null);
+  });
+
+  it("getSubmodelById (string id)", function() {
+    var map = helper.createCustomMap();
+    assert.ok(map.getSubmodelById(map.getId() + ""));
+  });
+
   it("customizeGoogleMapView 2", function() {
     var map = helper.createCustomMap();
     map.customizeGoogleMapView(true);
   });
-  
-  
 
   it("openLayoutById (not existing)", function() {
     var map = helper.createCustomMap();
@@ -61,7 +75,7 @@ describe('CustomMap', function() {
     var model = options.getProject().getModel();
     var layout = model.getLayouts()[0];
     var map = new CustomMap(options);
-    map.openLayoutById(layout.getId()+"");
+    map.openLayoutById(layout.getId() + "");
     assert.equal(logger.getErrors().length, 0);
   });