Index: src/Actions/FillAction/FillRegularGridAction.cpp
===================================================================
--- src/Actions/FillAction/FillRegularGridAction.cpp	(revision 42b6de7c684d4c908777f116dccaf00a8e479cf2)
+++ src/Actions/FillAction/FillRegularGridAction.cpp	(revision 531f27764dc2eabbcb727eb49be1867ac1257e30)
@@ -24,4 +24,5 @@
 #include "Atom/AtomicInfo.hpp"
 #include "Atom/CopyAtoms/CopyAtoms_withBonds.hpp"
+#include "Bond/BondInfo.hpp"
 #include "CodePatterns/Log.hpp"
 #include "Descriptors/MoleculeOrderDescriptor.hpp"
@@ -67,5 +68,6 @@
   getParametersfromValueStorage();
 
-  // get the filler molecule and move to origin
+  // get the filler molecule
+  std::vector<AtomicInfo> movedatoms;
   const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules();
   if (molecules.size() != 1) {
@@ -74,4 +76,6 @@
   }
   molecule *filler = *(molecules.begin());
+  for(molecule::const_iterator iter = filler->begin(); iter != filler->end(); ++iter)
+    movedatoms.push_back( AtomicInfo(*(*iter)) );
   LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms.");
 
@@ -82,7 +86,8 @@
   Tesselation * TesselStruct = NULL;
   if (params.SphereRadius != 0.) {
-    if ( molecules.size() == 0) {
+    if ( atoms.size() == 0) {
       ELOG(1, "You have given a sphere radius " << params.SphereRadius
           << " != 0, but have not select any molecules.");
+      return Action::failure;
     }
     // create adaptor for the selected atoms
@@ -99,5 +104,5 @@
 
   // create predicate, mesh, and filler
-  std::vector<AtomicInfo> clonedatoms;
+  FillRegularGridState *UndoState = NULL;
   bool successflag = false;
   {
@@ -129,5 +134,7 @@
       delete fillerFunction;
 
-      // append each cluster's atoms to clonedatoms
+      // append each cluster's atoms to clonedatoms (however not selected ones)
+      std::vector<const atom *> clonedatoms;
+      std::vector<AtomicInfo> clonedatominfos;
       for (Filler::ClusterVector_t::const_iterator iter = ClonedClusters.begin();
           iter != ClonedClusters.end(); ++iter) {
@@ -135,10 +142,23 @@
         clonedatoms.reserve(clonedatoms.size()+atoms.size());
         for (AtomIdSet::const_iterator atomiter = atoms.begin(); atomiter != atoms.end(); ++atomiter)
-          clonedatoms.push_back( AtomicInfo(*(*atomiter)) );
+          if (!filler->containsAtom(*atomiter)) {
+            clonedatoms.push_back( *atomiter );
+            clonedatominfos.push_back( AtomicInfo(*(*atomiter)) );
+          }
       }
+      std::vector< BondInfo > clonedbonds;
+      StoreBondInformationFromAtoms(clonedatoms, clonedbonds);
+      LOG(2, "DEBUG: There are " << clonedatominfos.size() << " newly created atoms.");
+
       if (!successflag) {
-        ELOG(1, "Insertion failed, removing inserted clusters again.");
-        RemoveAtomsFromAtomicInfo(clonedatoms);
+        ELOG(1, "Insertion failed, removing inserted clusters, translating original one back");
+        RemoveAtomsFromAtomicInfo(clonedatominfos);
         clonedatoms.clear();
+        SetAtomsFromAtomicInfo(movedatoms);
+      } else {
+        std::vector<Vector> MovedToVector(filler->size(), zeroVec);
+        std::transform(filler->begin(), filler->end(), MovedToVector.begin(),
+            boost::bind(&AtomInfo::getPosition, _1) );
+        UndoState = new FillRegularGridState(clonedatominfos,clonedbonds,movedatoms,MovedToVector,params);
       }
     }
@@ -154,5 +174,5 @@
 
   if (successflag)
-    return Action::state_ptr(new FillRegularGridState(clonedatoms,params));
+    return Action::state_ptr(UndoState);
   else
     return Action::failure;
@@ -164,4 +184,6 @@
   // remove all created atoms
   RemoveAtomsFromAtomicInfo(state->clonedatoms);
+  // add the original cluster
+  SetAtomsFromAtomicInfo(state->movedatoms);
 
   return Action::state_ptr(_state);
@@ -171,5 +193,14 @@
   FillRegularGridState *state = assert_cast<FillRegularGridState*>(_state.get());
 
-  if (AddAtomsFromAtomicInfo(state->clonedatoms))
+  // place filler cluster again at new spot
+  ResetAtomPosition(state->movedatoms, state->MovedToVector);
+
+  // re-create all clusters
+  bool statusflag = AddAtomsFromAtomicInfo(state->clonedatoms);
+
+  // re-create the bonds
+  if (statusflag)
+    AddBondsFromBondInfo(state->clonedbonds);
+  if (statusflag)
     return Action::state_ptr(_state);
   else
