diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java
index 6c3e0e4b4e3ad0b57f56dd6a9f72daf0a9e7e48d..30af2b895ccf5a95a22443cb78cabedfe1615dcc 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java
@@ -111,9 +111,12 @@ public class VocabularyTermPE extends HibernateAbstractRegistrationHolder implem
 
     public void setVocabulary(final VocabularyPE vocabulary)
     {
-        if (vocabulary == null && getVocabulary() != null)
+        if (vocabulary == null)
         {
-            getVocabulary().removeTerm(this);
+            if (getVocabulary() != null)
+            {
+                getVocabulary().removeTerm(this);
+            }
         } else
         {
             vocabulary.addTerm(this);