diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MeSHParser.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MeSHParser.java
index 84d2a479626c345beca3fd0d74f7ddbaacee88d5..e7882624e92231c63bf63f9ba5cb4cce581d5c45 100644
--- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MeSHParser.java
+++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MeSHParser.java
@@ -109,6 +109,9 @@ public class MeSHParser extends CachableInterface implements IExternalService {
     if (meshID == null || meshID.getResource() == null) {
       throw new InvalidArgumentException("mesh cannot be null ");
     }
+    if (meshID.getResource().indexOf(" ") >= 0) {
+      return null;
+    }
 
     MeSH mesh = null;
     // look for Mesh in the cache
@@ -321,7 +324,7 @@ public class MeSHParser extends CachableInterface implements IExternalService {
     ArrayList<?> hitsList = (ArrayList<?>) hits.get("hits");
     for (Object object : hitsList) {
       StringMap<?> hit = (StringMap<?>) object;
-      String  id = (String) hit.get("_id");
+      String id = (String) hit.get("_id");
       result.add(new MiriamData(MiriamType.MESH_2012, id));
     }
     return result;
diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MeSHParserTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MeSHParserTest.java
index 8fb197d385fefbc71cb198e72db6a690aaeefb12..720bc0ebfcb9b47fc7c438691b5bb21e4bbfd505 100644
--- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MeSHParserTest.java
+++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MeSHParserTest.java
@@ -118,6 +118,18 @@ public class MeSHParserTest extends AnnotationTestFunctions {
     }
   }
 
+  @Test
+  public void testIsValidWithSpace() throws Exception {
+    try {
+      MiriamData meshID = new MiriamData(MiriamType.MESH_2012, "some disease");
+      assertFalse(meshParser.isValidMeshId(meshID));
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      throw e;
+    }
+  }
+
   @Test
   public void testGetInvalidMesh() throws Exception {
     try {
diff --git a/frontend-js/src/main/js/GuiConnector.js b/frontend-js/src/main/js/GuiConnector.js
index 2f74cd06ebe9e40ced29e7a03c54e3d9e4b9992e..b15a812aaf317e9537f6f26afa06b8b32de0b8df 100644
--- a/frontend-js/src/main/js/GuiConnector.js
+++ b/frontend-js/src/main/js/GuiConnector.js
@@ -229,7 +229,7 @@ GuiConnector.prototype.hideProcessing = function () {
 
 /**
  *
- * @param {string} error
+ * @param {string|Error} error
  * @param {boolean} [redirectIfSecurityError]
  */
 GuiConnector.prototype.alert = function (error, redirectIfSecurityError) {
diff --git a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js
index 48302bde7f5e869b45a5431a2b8c4c20bf7415ba..6cf0bef6c26e521c5a66bb9939348f96a83de91a 100644
--- a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js
+++ b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js
@@ -10,6 +10,8 @@ var CommentsTab = require('./CommentsAdminPanel');
 var GuiConnector = require('../../GuiConnector');
 var PrivilegeType = require('../../map/data/PrivilegeType');
 var ValidationError = require("../../ValidationError");
+var HttpStatus = require('http-status-codes');
+var NetworkError = require('../../NetworkError');
 
 var Functions = require('../../Functions');
 // noinspection JSUnusedLocalSymbols
@@ -256,7 +258,14 @@ EditProjectDialog.prototype.createGeneralTabContent = function () {
         return self.callListeners("onSave");
       }).then(function () {
         return self.close();
-      }).catch(GuiConnector.alert);
+      }).catch(function (error) {
+
+        if ((error instanceof NetworkError && error.statusCode === HttpStatus.BAD_REQUEST)) {
+          GuiConnector.alert(error.content.reason);
+        } else {
+          GuiConnector.alert(error);
+        }
+      });
     },
     xss: false
   });
diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectRestImpl.java
index b0d4cee6b5a1daaa65835f322cb113bcb8e89719..97bd15c2f02acc99908f6bf2d08cbb8fc1f4da83 100644
--- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectRestImpl.java
+++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectRestImpl.java
@@ -28,6 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.MultiValueMap;
 
+import lcsb.mapviewer.annotation.services.MeSHParser;
+import lcsb.mapviewer.annotation.services.annotators.AnnotatorException;
 import lcsb.mapviewer.api.BaseRestImpl;
 import lcsb.mapviewer.api.ObjectExistsException;
 import lcsb.mapviewer.api.ObjectNotFoundException;
@@ -111,6 +113,9 @@ public class ProjectRestImpl extends BaseRestImpl {
   @Autowired
   private IProjectService projectService;
 
+  @Autowired
+  private MeSHParser meshParser;
+
   @Autowired
   private ProjectDao projectDao;
 
@@ -549,8 +554,19 @@ public class ProjectRestImpl extends BaseRestImpl {
         MiriamData organism = updateMiriamData(project.getOrganism(), value);
         project.setOrganism(organism);
       } else if (fieldName.equalsIgnoreCase("disease")) {
-        MiriamData disease = updateMiriamData(project.getDisease(), value);
-        project.setDisease(disease);
+        try {
+          MiriamData sourceData = updateMiriamData(null, value);
+          if (meshParser.isValidMeshId(sourceData)) {
+            MiriamData disease = updateMiriamData(project.getDisease(), value);
+            project.setDisease(disease);
+          } else if (sourceData.getResource().isEmpty()) {
+            project.setDisease(null);
+          } else {
+            throw new QueryException("invalid mesh identifier: " + value);
+          }
+        } catch (AnnotatorException e) {
+          throw new QueryException("invalid miriamdData: " + value, e);
+        }
       } else if (fieldName.equalsIgnoreCase("mapCanvasType")) {
         MapCanvasType mapCanvasType;
         try {
@@ -740,7 +756,8 @@ public class ProjectRestImpl extends BaseRestImpl {
   public Map<String, Object> removeProject(String token, String projectId, String path)
       throws SecurityException, QueryException {
     Project project = getProjectService().getProjectByProjectId(projectId, token);
-    if (getConfigurationService().getConfigurationValue(ConfigurationElementType.DEFAULT_MAP).equals(project.getProjectId())) {
+    if (getConfigurationService().getConfigurationValue(ConfigurationElementType.DEFAULT_MAP)
+        .equals(project.getProjectId())) {
       throw new OperationNotAllowedException("You cannot remove default map");
     }
     getProjectService().removeProject(project, path, true, token);