Index: src/Actions/SelectionAction/Molecules/AllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/Molecules/AllMoleculesAction.cpp	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/AllMoleculesAction.cpp	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -55,5 +55,6 @@
 /** =========== define the function ====================== */
 ActionState::ptr SelectionAllMoleculesAction::performCall() {
-  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  const std::vector<const molecule *> selectedMolecules =
+      const_cast<const World &>(World::getInstance()).getSelectedMolecules();
   LOG(1, "Selecting all molecules.");
   World::getInstance().selectAllMolecules(AllMolecules());
@@ -66,5 +67,5 @@
 
   World::getInstance().clearMoleculeSelection();
-  BOOST_FOREACH(molecule *_mol, state->selectedMolecules)
+  BOOST_FOREACH(const molecule *_mol, state->selectedMolecules)
     World::getInstance().selectMolecule(_mol);
 
Index: src/Actions/SelectionAction/Molecules/AllMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/Molecules/AllMoleculesAction.def	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/AllMoleculesAction.def	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -20,5 +20,5 @@
 #undef paramvalids
 
-#define statetypes (std::vector<molecule*>)
+#define statetypes (std::vector<const molecule*>)
 #define statereferences (selectedMolecules)
 
Index: src/Actions/SelectionAction/Molecules/ClearAllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/Molecules/ClearAllMoleculesAction.cpp	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/ClearAllMoleculesAction.cpp	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -54,5 +54,6 @@
 /** =========== define the function ====================== */
 ActionState::ptr SelectionClearAllMoleculesAction::performCall() {
-  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  const std::vector<const molecule *> selectedMolecules =
+      const_cast<const World &>(World::getInstance()).getSelectedMolecules();
   LOG(1, "Clearing molecule selection.");
   World::getInstance().clearMoleculeSelection();
@@ -65,5 +66,5 @@
 
   World::getInstance().clearMoleculeSelection();
-  BOOST_FOREACH(molecule *_mol, state->selectedMolecules)
+  BOOST_FOREACH(const molecule *_mol, state->selectedMolecules)
     World::getInstance().selectMolecule(_mol);
 
Index: src/Actions/SelectionAction/Molecules/ClearAllMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/Molecules/ClearAllMoleculesAction.def	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/ClearAllMoleculesAction.def	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -20,5 +20,5 @@
 #undef paramvalids
 
-#define statetypes (std::vector<molecule*>)
+#define statetypes (std::vector<const molecule*>)
 #define statereferences (selectedMolecules)
 
Index: src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp
===================================================================
--- src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -54,5 +54,6 @@
 /** =========== define the function ====================== */
 ActionState::ptr SelectionMoleculeOfAtomAction::performCall() {
-  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  const std::vector<const molecule *> selectedMolecules =
+      const_cast<const World &>(World::getInstance()).getSelectedMolecules();
   LOG(1, "Selecting molecule to currently selected atoms: " << World::getInstance().countSelectedAtoms());
   World::getInstance().selectAllMolecules(MoleculesByAtomSelection());
@@ -65,5 +66,5 @@
 
   World::getInstance().clearMoleculeSelection();
-  BOOST_FOREACH(molecule *_mol, state->selectedMolecules)
+  BOOST_FOREACH(const molecule *_mol, state->selectedMolecules)
     World::getInstance().selectMolecule(_mol);
 
Index: src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.def
===================================================================
--- src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.def	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.def	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -20,5 +20,5 @@
 #undef paramvalids
 
-#define statetypes (std::vector<molecule*>)
+#define statetypes (std::vector<const molecule*>)
 #define statereferences (selectedMolecules)
 
Index: src/Actions/SelectionAction/Molecules/NotAllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/Molecules/NotAllMoleculesAction.cpp	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/NotAllMoleculesAction.cpp	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -54,5 +54,6 @@
 /** =========== define the function ====================== */
 ActionState::ptr SelectionNotAllMoleculesAction::performCall() {
-  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  const std::vector<const molecule *> selectedMolecules =
+      const_cast<const World &>(World::getInstance()).getSelectedMolecules();
   LOG(1, "Unselecting all molecules.");
   World::getInstance().clearMoleculeSelection();
@@ -65,5 +66,5 @@
 
   World::getInstance().clearMoleculeSelection();
-  BOOST_FOREACH(molecule *_mol, state->unselectedMolecules)
+  BOOST_FOREACH(const molecule *_mol, state->selectedMolecules)
     World::getInstance().selectMolecule(_mol);
 
Index: src/Actions/SelectionAction/Molecules/NotAllMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/Molecules/NotAllMoleculesAction.def	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/NotAllMoleculesAction.def	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -20,6 +20,6 @@
 #undef paramvalids
 
-#define statetypes (std::vector<molecule*>)
-#define statereferences (unselectedMolecules)
+#define statetypes (std::vector<const molecule*>)
+#define statereferences (selectedMolecules)
 
 // some defines for all the names, you may use ACTION, STATE and PARAMS
Index: src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.cpp
===================================================================
--- src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.cpp	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.cpp	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -54,9 +54,10 @@
 /** =========== define the function ====================== */
 ActionState::ptr SelectionNotMoleculeOfAtomAction::performCall() {
-  std::vector<molecule *> unselectedMolecules = World::getInstance().getSelectedMolecules();
+  const std::vector<const molecule *> selectedMolecules =
+      const_cast<const World &>(World::getInstance()).getSelectedMolecules();
   LOG(1, "Unselecting molecule to currently selected atoms.");
   World::getInstance().unselectAllMolecules(MoleculesByAtomSelection());
   LOG(0, World::getInstance().countSelectedMolecules() << " molecules remain selected.");
-  return ActionState::ptr(new SelectionNotMoleculeOfAtomState(unselectedMolecules, params));
+  return ActionState::ptr(new SelectionNotMoleculeOfAtomState(selectedMolecules, params));
 }
 
@@ -65,5 +66,5 @@
 
   World::getInstance().clearMoleculeSelection();
-  BOOST_FOREACH(molecule *_mol, state->unselectedMolecules)
+  BOOST_FOREACH(const molecule *_mol, state->selectedMolecules)
     World::getInstance().selectMolecule(_mol);
 
Index: src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.def
===================================================================
--- src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.def	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/NotMoleculeOfAtomAction.def	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -20,6 +20,6 @@
 #undef paramvalids
 
-#define statetypes (std::vector<molecule*>)
-#define statereferences (unselectedMolecules)
+#define statetypes (std::vector<const molecule*>)
+#define statereferences (selectedMolecules)
 
 // some defines for all the names, you may use ACTION, STATE and PARAMS
Index: src/Actions/SelectionAction/Molecules/PopMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/Molecules/PopMoleculesAction.cpp	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/PopMoleculesAction.cpp	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -50,13 +50,9 @@
 ActionState::ptr SelectionPopMoleculesAction::performCall() {
   // create undo state
-  const std::vector<molecule *> selected_mols = World::getInstance().getSelectedMolecules();
-  std::vector<moleculeId_t> selected_molids(selected_mols.size(), (moleculeId_t)-1);
-  std::transform(
-      selected_mols.begin(), selected_mols.end(),
-      selected_molids.begin(),
-      boost::bind(&molecule::getId, _1));
+  const std::vector<const molecule *> selectedMolecules =
+      const_cast<const World &>(World::getInstance()).getSelectedMolecules();
   LOG(1, "Popping molecule selection.");
   World::getInstance().popMoleculeSelection();
-  return ActionState::ptr(new SelectionPopMoleculesState(selected_molids, params));
+  return ActionState::ptr(new SelectionPopMoleculesState(selectedMolecules, params));
 }
 
@@ -66,7 +62,7 @@
   World::getInstance().pushMoleculeSelection();
   // re-create old selection
-  for(std::vector<moleculeId_t>::const_iterator iter = state->selected_molids.begin();
-      iter != state->selected_molids.end(); ++iter)
-    World::getInstance().selectMolecule(*iter);
+  World::getInstance().clearMoleculeSelection();
+  BOOST_FOREACH(const molecule *_mol, state->selectedMolecules)
+    World::getInstance().selectMolecule(_mol);
 
   return ActionState::ptr(_state);
Index: src/Actions/SelectionAction/Molecules/PopMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/Molecules/PopMoleculesAction.def	(revision 1259df9500410b59c3a56d9cf8d54624b53f97da)
+++ src/Actions/SelectionAction/Molecules/PopMoleculesAction.def	(revision fac58f919238a82bc5d6cab2eb5c9621c85c941c)
@@ -20,6 +20,6 @@
 #undef paramvalids
 
-#define statetypes (std::vector<moleculeId_t>)
-#define statereferences (selected_molids)
+#define statetypes (std::vector<const molecule *>)
+#define statereferences (selectedMolecules)
 
 // some defines for all the names, you may use ACTION, STATE and PARAMS
