Index: src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp	(revision 5c9604040c713fbb9e27910f306ad00d9fa4b903)
+++ src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp	(revision 805fdc2cd99d90fe43f515b48ca05c3a3a41ad5c)
@@ -253,32 +253,53 @@
   LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+".");
 
-  // if atom is not in map, then GLMoleculeObject_molecule is already present anyway.
-  if (QtObservedAtomMap.count(_atomid)) {
-    const QtObservedAtom::ptr atom = QtObservedAtomMap[_atomid];
-    const moleculeId_t molid = atom->getAtomMoleculeIndex();
-    // check of molecule is already present
-    boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
-    const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
-    if (moliter != MoleculesinSceneMap.end()) {
-      QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
-      if (checkmol.get() == _mol) {
-        LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)+".");
-        QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
-                                  "atomRemoved",       // member name (no parameters here)
-                                  Qt::QueuedConnection,     // connection type
-                                  Q_ARG(const atomId_t, _atomid));     // parameters
-      } else {
-        // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
-        LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)
-            +" to molecule in RemovedMolecules.");
-        const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
-        ASSERT( removedmoliter != RemovedMolecules.end(),
-            "GLWorldScene::moleculesAtomRemoved() - signal from old mol "
-            +toString(molid)+", but not present in RemovedMolecules");
-        QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
-                                  "atomRemoved",       // member name (no parameters here)
-                                  Qt::QueuedConnection,     // connection type
-                                  Q_ARG(const atomId_t, _atomid));     // parameters
-      }
+  const moleculeId_t molid = _mol->getMolIndex();
+  // check of molecule is already present
+  boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
+  const MoleculeNodeMap::iterator moliter = MoleculesinSceneMap.find(molid);
+  if (moliter != MoleculesinSceneMap.end()) {
+    const QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
+    if (checkmol.get() == _mol) {
+      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)+".");
+      QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
+                                "atomRemoved",       // member name (no parameters here)
+                                Qt::QueuedConnection,     // connection type
+                                Q_ARG(const atomId_t, _atomid));     // parameters
+    } else {
+      // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
+      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomRemoved for atom "+toString(_atomid)
+          +" to molecule in RemovedMolecules.");
+      const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
+      ASSERT( removedmoliter != RemovedMolecules.end(),
+          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
+          +toString(molid)+", but not present in RemovedMolecules");
+#ifndef NDEBUG
+      const QtObservedMolecule::ptr &othercheckmol = removedmoliter->second->ObservedMolecule;
+#endif
+      ASSERT( othercheckmol.get() == _mol,
+          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
+          +toString(molid)+", but different one "+toString(othercheckmol)
+          +" present in RemovedMolecules.");
+      QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
+                                "atomRemoved",       // member name (no parameters here)
+                                Qt::QueuedConnection,     // connection type
+                                Q_ARG(const atomId_t, _atomid));     // parameters
+    }
+  } else {
+    const MoleculeNodeMap::iterator removedmoliter = RemovedMolecules.find(molid);
+    if (removedmoliter != RemovedMolecules.end()) {
+      ASSERT( removedmoliter != RemovedMolecules.end(),
+          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
+          +toString(molid)+", but not present in RemovedMolecules");
+#ifndef NDEBUG
+      const QtObservedMolecule::ptr &othercheckmol = removedmoliter->second->ObservedMolecule;
+#endif
+      ASSERT( othercheckmol.get() == _mol,
+          "GLWorldScene::moleculesAtomRemoved() - signal from old molecule "
+          +toString(molid)+", but different one "+toString(othercheckmol)
+          +" present in RemovedMolecules.");
+      QMetaObject::invokeMethod(removedmoliter->second,        // pointer to a QObject
+                                "atomRemoved",       // member name (no parameters here)
+                                Qt::QueuedConnection,     // connection type
+                                Q_ARG(const atomId_t, _atomid));     // parameters
     } else {
       boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
