diff --git a/DDCAD/src/plugins/CADPlugins.cpp b/DDCAD/src/plugins/CADPlugins.cpp
index 606465c083258985d5e2f3c78d92ef465c201677..85dae01e456e090d230cb5e702bc75a450af783a 100644
--- a/DDCAD/src/plugins/CADPlugins.cpp
+++ b/DDCAD/src/plugins/CADPlugins.cpp
@@ -129,8 +129,10 @@ static dd4hep::Handle<TObject> create_CAD_Assembly(dd4hep::Detector& dsc, xml_h
            "understandable tessellated volumes.", fname.c_str());
   }
   dd4hep::Assembly assembly("assembly");
-  for(std::size_t i=0; i < volumes.size(); ++i)
-    assembly.placeVolume(volumes[i].release());
+  for(std::size_t i=0; i < volumes.size(); ++i)  {
+    dd4hep::Volume vol(volumes[i].release());
+    assembly.placeVolume(vol);
+  }
 
   if ( elt.hasAttr(_U(name)) ) assembly->SetName(elt.attr<std::string>(_U(name)).c_str());
   return assembly;
diff --git a/DDCore/include/DD4hep/detail/AlignmentsInterna.h b/DDCore/include/DD4hep/detail/AlignmentsInterna.h
index 2c6dc41ceca8e15df808fd978651c2b03fd08145..172aba2c78c7f453204ca74bc290fafddd12ba23 100644
--- a/DDCore/include/DD4hep/detail/AlignmentsInterna.h
+++ b/DDCore/include/DD4hep/detail/AlignmentsInterna.h
@@ -22,9 +22,9 @@
 #define DD4HEP_DETAIL_ALIGNMENTSINTERNA_H
 
 // Framework include files
-#include "DD4hep/IOV.h"
-#include "DD4hep/Alignments.h"
-#include "DD4hep/detail/ConditionsInterna.h"
+#include <DD4hep/IOV.h>
+#include <DD4hep/Alignments.h>
+#include <DD4hep/detail/ConditionsInterna.h>
 
 // C/C++ include files
 #include <map>
diff --git a/DDCore/include/DD4hep/detail/ConditionsInterna.h b/DDCore/include/DD4hep/detail/ConditionsInterna.h
index 518dc06c878236112324457801b9d0fc5efccfa4..186a60ed9ffa3a0956b3faab184b449986dcb565 100644
--- a/DDCore/include/DD4hep/detail/ConditionsInterna.h
+++ b/DDCore/include/DD4hep/detail/ConditionsInterna.h
@@ -22,10 +22,10 @@
 #define DD4HEP_DETAIL_CONDITIONSINTERNA_H
 
 // Framework include files
-#include "DD4hep/DetElement.h"
-#include "DD4hep/Conditions.h"
-#include "DD4hep/Grammar.h"
-#include "DD4hep/NamedObject.h"
+#include <DD4hep/DetElement.h>
+#include <DD4hep/Conditions.h>
+#include <DD4hep/Grammar.h>
+#include <DD4hep/NamedObject.h>
 
 // C/C++ include files
 #include <map>
diff --git a/DDCore/include/DD4hep/detail/ContainerHelpers.h b/DDCore/include/DD4hep/detail/ContainerHelpers.h
index 2ae63704a34dfa547aedce4a8bf04d1cc34a7f92..8f5137dcc42f56bfdcfb3d21cec38264d57cf92a 100644
--- a/DDCore/include/DD4hep/detail/ContainerHelpers.h
+++ b/DDCore/include/DD4hep/detail/ContainerHelpers.h
@@ -14,7 +14,7 @@
 #define DD4HEP_DETAIL_CONTAINERHELPERS_H
 
 // Framework include files
-#include "DD4hep/Primitives.h"
+#include <DD4hep/Primitives.h>
 
 // C/C++ include files
 #include <map>
diff --git a/DDCore/include/DD4hep/detail/DetectorInterna.h b/DDCore/include/DD4hep/detail/DetectorInterna.h
index 2086c885a5e5bc275d6e27a7e0f740fe369bb75b..afe8d46cf6c2ebab19158a4b762e175e5f9b23ff 100644
--- a/DDCore/include/DD4hep/detail/DetectorInterna.h
+++ b/DDCore/include/DD4hep/detail/DetectorInterna.h
@@ -22,18 +22,18 @@
 #define DD4HEP_DETAIL_DETECTORINTERNA_H
 
 // Framework include files
-#include "DD4hep/Callback.h"
-#include "DD4hep/NamedObject.h"
-#include "DD4hep/World.h"
-#include "DD4hep/Objects.h"
-#include "DD4hep/DetElement.h"
-#include "DD4hep/Alignments.h"
-#include "DD4hep/Conditions.h"
-#include "DD4hep/Segmentations.h"
-#include "DD4hep/ObjectExtensions.h"
+#include <DD4hep/Callback.h>
+#include <DD4hep/NamedObject.h>
+#include <DD4hep/World.h>
+#include <DD4hep/Objects.h>
+#include <DD4hep/DetElement.h>
+#include <DD4hep/Alignments.h>
+#include <DD4hep/Conditions.h>
+#include <DD4hep/Segmentations.h>
+#include <DD4hep/ObjectExtensions.h>
 
 // ROOT include files
-#include "TGeoMatrix.h"
+#include <TGeoMatrix.h>
 
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
diff --git a/DDCore/include/DD4hep/detail/ObjectsInterna.h b/DDCore/include/DD4hep/detail/ObjectsInterna.h
index cef152fc692d80106addf8d3120d5f6018b0963d..178f4c194608db44b98f8d5947a38199a5211c93 100644
--- a/DDCore/include/DD4hep/detail/ObjectsInterna.h
+++ b/DDCore/include/DD4hep/detail/ObjectsInterna.h
@@ -14,11 +14,11 @@
 #define DD4HEP_DETAIL_OBJECTSINTERNA_H
 
 // Framework include files
-#include "DD4hep/Volumes.h"
-#include "DD4hep/NamedObject.h"
-#include "DD4hep/IDDescriptor.h"
-#include "DD4hep/Segmentations.h"
-#include "DD4hep/BitFieldCoder.h"
+#include <DD4hep/Volumes.h>
+#include <DD4hep/NamedObject.h>
+#include <DD4hep/IDDescriptor.h>
+#include <DD4hep/Segmentations.h>
+#include <DD4hep/BitFieldCoder.h>
 
 // C/C++ include files
 #include <set>
diff --git a/DDCore/include/DD4hep/detail/Plugins.inl b/DDCore/include/DD4hep/detail/Plugins.inl
index d26913c114240466116df71734d9032ec53fd457..008800264ffe96bba9cae556a1c4e67b507cf32a 100644
--- a/DDCore/include/DD4hep/detail/Plugins.inl
+++ b/DDCore/include/DD4hep/detail/Plugins.inl
@@ -26,10 +26,10 @@
 #define Reflex_CollectionProxy 1
 #endif
 
-#include "DD4hep/Printout.h"
-#include "Reflex/PluginService.h"
-#include "Reflex/Reflex.h"
-#include "Reflex/Builder/ReflexBuilder.h"
+#include <DD4hep/Printout.h>
+#include <Reflex/PluginService.h>
+#include <Reflex/Reflex.h>
+#include <Reflex/Builder/ReflexBuilder.h>
 
 /// The dd4hep namespace declaration
 namespace dd4hep  {
diff --git a/DDCore/include/DD4hep/detail/SegmentationsInterna.h b/DDCore/include/DD4hep/detail/SegmentationsInterna.h
index bdc37f499943ede157aef5589b863f2e8218cbdf..c8a895ba0dfd803ac86c7c35d4e17f9892d61ab5 100644
--- a/DDCore/include/DD4hep/detail/SegmentationsInterna.h
+++ b/DDCore/include/DD4hep/detail/SegmentationsInterna.h
@@ -14,9 +14,9 @@
 #define DD4HEP_DETAIL_SEGMENTATIONSINTERNA_H
 
 // Framework include files
-#include "DD4hep/Handle.h"
-#include "DD4hep/Objects.h"
-#include "DD4hep/BitFieldCoder.h"
+#include <DD4hep/Handle.h>
+#include <DD4hep/Objects.h>
+#include <DD4hep/BitFieldCoder.h>
 
 // C/C++ include files
 
diff --git a/DDCore/include/DD4hep/detail/ShapesInterna.h b/DDCore/include/DD4hep/detail/ShapesInterna.h
index d2a4bd7b8e106c678a8db83e7fde70226351d0b5..f8ad3fb8f7fd763f1385b4ae9bbdb117725a7e9b 100644
--- a/DDCore/include/DD4hep/detail/ShapesInterna.h
+++ b/DDCore/include/DD4hep/detail/ShapesInterna.h
@@ -14,7 +14,7 @@
 #define DD4HEP_DETAIL_SHAPESINTERNA_H
 
 // Framework include files
-#include "DD4hep/Shapes.h"
+#include <DD4hep/Shapes.h>
 
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
diff --git a/DDCore/include/DD4hep/detail/VolumeManagerInterna.h b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h
index 1c204b7267b7b7d7db47c94f06dd0d621399e42a..dafd1210a3171c8182cebb2f4d732fa62963a3a3 100644
--- a/DDCore/include/DD4hep/detail/VolumeManagerInterna.h
+++ b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h
@@ -22,13 +22,13 @@
 #define DD4HEP_DETAIL_VOLUMEMANAGERINTERNA_H
 
 // Framework include files
-#include "DD4hep/Volumes.h"
-#include "DD4hep/DetElement.h"
-#include "DD4hep/IDDescriptor.h"
-#include "DD4hep/VolumeManager.h"
+#include <DD4hep/Volumes.h>
+#include <DD4hep/DetElement.h>
+#include <DD4hep/IDDescriptor.h>
+#include <DD4hep/VolumeManager.h>
 
 // ROOT include files
-#include "TGeoMatrix.h"
+#include <TGeoMatrix.h>
 
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
diff --git a/DDCore/src/DetElement.cpp b/DDCore/src/DetElement.cpp
index 6f0dce1b121e4c7ed971cfa858d5592f323d0d2e..d24f6e5043468e71026abee6c6fb7a8eb150c1c7 100644
--- a/DDCore/src/DetElement.cpp
+++ b/DDCore/src/DetElement.cpp
@@ -18,8 +18,8 @@
 #include <DD4hep/AlignmentTools.h>
 #include <DD4hep/DetectorTools.h>
 #include <DD4hep/Printout.h>
-#include <DD4hep/World.h>
 #include <DD4hep/Detector.h>
+#include <DD4hep/World.h>
 
 using namespace dd4hep;
     
@@ -104,6 +104,7 @@ DetElement& DetElement::setType(const std::string& typ) {
   return *this;
 }
 
+/// Access the type of the sensitive detector
 unsigned int DetElement::typeFlag() const {
   return m_element ? m_element->typeFlag :  0 ;
 }
diff --git a/DDCore/src/XML/Utilities.cpp b/DDCore/src/XML/Utilities.cpp
index 16bf0e264f1777da9bbf8bb261b0a961a6d41740..98ae694b7677fa87ec22add2df429400cfefbed5 100644
--- a/DDCore/src/XML/Utilities.cpp
+++ b/DDCore/src/XML/Utilities.cpp
@@ -99,10 +99,10 @@ dd4hep::Solid dd4hep::xml::createShape(Detector& description,
 /// Create a volume using the plugin mechanism from the attributes of the XML element
 dd4hep::Volume dd4hep::xml::createStdVolume(Detector& description, xml::Element element)    {
   Volume      vol;
-  int         dbg = 1;
   xml_dim_t   elt(element);
   std::string typ, tag = elt.tag();
-  PrintLevel  lvl   = dbg ? ALWAYS : DEBUG;
+  PrintLevel  lvl   = ALWAYS;
+  //PrintLevel  lvl   = DEBUG;
 
   printout(lvl, "xml::createStdVolume", "++ Processing tag: %-12s", tag.c_str());
   if ( elt.hasAttr(_U(material)) )   {
diff --git a/DDDigi/include/DDDigi/DigiAction.h b/DDDigi/include/DDDigi/DigiAction.h
index 11ab4fd5950e58d5c7f203280c2992b236aa9e99..31dfb86eba6118de12494b060103f7209d632e58 100644
--- a/DDDigi/include/DDDigi/DigiAction.h
+++ b/DDDigi/include/DDDigi/DigiAction.h
@@ -15,12 +15,15 @@
 
 // Framework include files
 #include <DD4hep/Printout.h>
+#include <DD4hep/ObjectExtensions.h>
 #include <DD4hep/ComponentProperties.h>
 #include <DDDigi/DigiContext.h>
 
 // C/C++ include files
 #include <string>
+#include <memory>
 #include <cstdarg>
+#include <cstdint>
 
 #if defined(G__ROOT) || defined(__CLING__) || defined(__ROOTCLING__)
 #define DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action)  public: action() = default;
@@ -44,6 +47,9 @@
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
 
+  /// Forward declarations
+  class ExtensionEntry;
+  
   /// Namespace for the Digitization part of the AIDA detector description toolkit
   namespace digi {
 
@@ -89,10 +95,38 @@ namespace dd4hep {
       friend class DigiKernel;
 
     public:
-      using context_t = DigiContext;
-      using kernel_t  = DigiKernel;
+      using context_t    = DigiContext;
+      using kernel_t     = DigiKernel;
+      using extensions_t = std::map<uint64_t, std::unique_ptr<ExtensionEntry> >;
 
     protected:
+      template <typename T> struct Extension : public ExtensionEntry {
+        T* ptr = 0;
+        
+        /// Inhibit default constructor
+        Extension() = delete;
+        /// Typed objects constructor
+        Extension(T* p) : ptr(p) { }
+        /// Copy constructor
+        Extension(const Extension& copy) = delete;
+        /// Assignment operator
+        Extension& operator=(const Extension& copy) = delete;
+        /// Copy constructor
+        Extension(Extension&& copy) = delete;
+        /// Assignment operator
+        Extension& operator=(Extension&& copy) = delete;
+        /// Default destructor
+        virtual ~Extension() = default;
+        /// Wrapper for the object destruction
+        virtual void* object()  const override      { return ptr;  }
+        /// Wrapper for the object destruction
+        virtual void  destruct()  const override    { delete ptr;  }
+        virtual void* copy(void*) const override    { return nullptr; }
+        virtual ExtensionEntry* clone(void*) const override   { return nullptr; }
+        virtual unsigned long long int hash64() const override   { return uint64_t(ptr); }
+      };
+
+
       /// Reference to the Digi context
 #if defined(G__ROOT) || defined(__CLING__) || defined(__ROOTCLING__)
       const kernel_t*  m_kernel;
@@ -110,12 +144,14 @@ namespace dd4hep {
       std::string        m_name;
       /// Property pool
       PropertyManager    m_properties;
+      ///
+      std::vector<void*> m_opt_properties;
+      /// Object extensions if used
+      extensions_t       m_extensions;
       /// Reference count. Initial value: 1
       long               m_refCount    = 1;
       /// Default property: Output level
       int                m_outputLevel = 3;
-      ///
-      std::vector<void*> m_opt_properties;
       
     protected:
       /// Define standard assignments and constructors
@@ -182,6 +218,18 @@ namespace dd4hep {
       /// Adopt named tool to delegate actions
       virtual void adopt_tool(DigiAction* action, const std::string& typ);
 
+      /// Add an extension object to the detector element
+      uint64_t addExtension(uint64_t key, std::unique_ptr<ExtensionEntry>&& e);
+
+      /// Access an existing extension object from the detector element
+      void* extension(uint64_t key);
+
+      /// Extend the detector element with an arbitrary structure accessible by the type
+      template <typename T> uint64_t addExtension(T* c)  {
+        std::unique_ptr<ExtensionEntry> e = std::make_unique<Extension<T> >(c);
+        return this->addExtension(uint64_t(c), std::move(e));
+      }
+      
       /** Support for output messages       */
       /// Support for messages with variable output level using output level
       void print(const char* fmt, ...) const;
diff --git a/DDDigi/plugins/DigiDepositDropKilled.cpp b/DDDigi/plugins/DigiDepositDropKilled.cpp
index 89b35f32e3a387a6c4e482abde1ed030c76a2349..235b777e88467ee4d9ecdcde245530bdc25ea369 100644
--- a/DDDigi/plugins/DigiDepositDropKilled.cpp
+++ b/DDDigi/plugins/DigiDepositDropKilled.cpp
@@ -53,6 +53,7 @@ namespace dd4hep {
               m->remove(iter);
               iter = (last_cell != ~0x0ULL) ? m->data.find(last_cell) : m->begin();
               if ( iter == m->end() ) iter = m->begin();
+              if ( iter == m->end() ) break;
               continue;
             }
             last_cell = iter->first;
diff --git a/DDDigi/src/DigiAction.cpp b/DDDigi/src/DigiAction.cpp
index d3e766dc8892089ac72432eea29cea4dbc90291b..15371b9640ead5ae6ba97e9e18503a8cc45a7a92 100644
--- a/DDDigi/src/DigiAction.cpp
+++ b/DDDigi/src/DigiAction.cpp
@@ -46,8 +46,9 @@ DigiAction::DigiAction(const DigiKernel& krnl, const std::string& nam)
 
 /// Default destructor
 DigiAction::~DigiAction() {
-  for(auto* ptr : m_opt_properties)
-    ::operator delete(ptr);
+  for( auto& ptr : m_extensions )
+    ptr.second->destruct();
+  m_extensions.clear();
   m_opt_properties.clear();
   InstanceCount::decrement(this);
 }
@@ -116,6 +117,21 @@ const dd4hep::Property& DigiAction::property(const std::string& nam)   const  {
   return properties()[nam];
 }
 
+/// Add an extension object to the detector element
+uint64_t DigiAction::addExtension(uint64_t key, std::unique_ptr<ExtensionEntry>&& e)  {
+  if ( m_extensions.emplace(key, std::move(e)).second )
+    return key;
+  return 0UL;
+}
+
+/// Access an existing extension object from the detector element
+void* DigiAction::extension(uint64_t key)  {
+  auto iter = m_extensions.find(key);
+  if ( iter != m_extensions.end() )
+    return iter->second.get();
+  return nullptr;
+}
+
 /// Support of debug messages.
 std::string DigiAction::format(const char* fmt, ...) const {
   va_list args;
@@ -227,21 +243,22 @@ namespace dd4hep {
     int add_action_property(DigiAction* action, const std::string& name, VAL value)   {
       VAL* new_val = new VAL(value);
       action->addProperty(name, *(new_val));
+      action->addExtension(new_val);
       printout(INFO, "addProperty", "+++ Added property %s of type %s",
 	       name.c_str(), typeName(typeid(VAL)).c_str());
       return 1;
     }
 
-#define ADD_SINGLE_PROPERTY(X)						\
+#define ADD_SINGLE_PROPERTY(X)                                          \
     template int add_action_property<X>(DigiAction* action, const std::string& name, X value);
 
-#define ADD_MAPPED_PROPERTY(K,X)					\
+#define ADD_MAPPED_PROPERTY(K,X)                                        \
     template int add_action_property<std::map<std::string,X> >(DigiAction* action, const std::string& name, std::map<K,X> value);
 
-#define ADD_PROPERTY(X) \
-    ADD_SINGLE_PROPERTY(X)						\
-    ADD_SINGLE_PROPERTY(std::set<X>)					\
-    ADD_SINGLE_PROPERTY(std::list<X>)					\
+#define ADD_PROPERTY(X)                         \
+    ADD_SINGLE_PROPERTY(X)                      \
+    ADD_SINGLE_PROPERTY(std::set<X>)            \
+    ADD_SINGLE_PROPERTY(std::list<X>)           \
     ADD_SINGLE_PROPERTY(std::vector<X>)					\
     ADD_MAPPED_PROPERTY(std::string,X)
 
diff --git a/DDDigi/src/DigiStoreDump.cpp b/DDDigi/src/DigiStoreDump.cpp
index 7fdf20bba0d5e437719abff7ef42dd7e0a968fea..26b49cdee1fb317ede5e8eff84191478e22e3947 100644
--- a/DDDigi/src/DigiStoreDump.cpp
+++ b/DDDigi/src/DigiStoreDump.cpp
@@ -118,7 +118,7 @@ DigiStoreDump::dump_history(DigiContext& context,
   std::vector<std::string> records;
 
   str << Key::key_name(container_key) << "[" << seq_no << "]:";
-  line = format("+----- %-30s Container: Segment:%04X Mask:%04X Item:%08X Cell:%016X Hist: Hits:%ld Parts:%ld",
+  line = format("+----- %-30s Container: Segment:%04X Mask:%04X Item:%08X Cell:%016lX History: Hits:%ld Parts:%ld",
 		str.str().c_str(), container_key.segment(), container_key.mask(), container_key.item(),
 		cell, item.history.hits.size(), item.history.particles.size());
   records.emplace_back(line);
diff --git a/DDG4/plugins/Geant4GDMLWriteAction.cpp b/DDG4/plugins/Geant4GDMLWriteAction.cpp
index 69d2382d5a0cf1f56ccfe2bb14f2722ee5799fc1..c13f441752a00934c9a41cbb40ad31dbdeb666e1 100644
--- a/DDG4/plugins/Geant4GDMLWriteAction.cpp
+++ b/DDG4/plugins/Geant4GDMLWriteAction.cpp
@@ -134,12 +134,12 @@ void Geant4GDMLWriteAction::writeGDML()   {
     error("+++ No GDML file name given. Please set the output file (property Output)");
     return;
   }
-  if ( 0 == ::stat(fname.c_str(), &buff) )   {
-    if ( !m_overWrite )  {
-      error("+++ GDML file %s elready exists. Please set another output file (property Output)",
-            fname.c_str());
-      return;
-    }
+  if ( (0 == ::stat(fname.c_str(), &buff)) && !m_overWrite )  {
+    error("+++ GDML file %s elready exists. Please set another output file (property Output)",
+          fname.c_str());
+    return;
+  }
+  else if ( 0 == ::stat(fname.c_str(), &buff) )  {
     warning("+++ GDML file %s already exists. Overwriting existing file.", fname.c_str());
     ::unlink(fname.c_str());
   }
diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp
index 00b871b920a2479031f52591d7ee7062ea953518..00b004af89e47276a5bce9450aa9486340982d72 100644
--- a/DDG4/src/Geant4Kernel.cpp
+++ b/DDG4/src/Geant4Kernel.cpp
@@ -39,7 +39,7 @@ using namespace dd4hep::sim;
 
 namespace {
   G4Mutex kernel_mutex=G4MUTEX_INITIALIZER;
-  dd4hep::dd4hep_ptr<Geant4Kernel> s_main_instance(0);
+  std::unique_ptr<Geant4Kernel> s_main_instance;
   void description_unexpected()    {
     try  {
       throw;
@@ -157,12 +157,12 @@ Geant4Kernel::~Geant4Kernel() {
 
 /// Instance accessor
 Geant4Kernel& Geant4Kernel::instance(Detector& description) {
-  if ( 0 == s_main_instance.get() )   {
+  if ( nullptr == s_main_instance.get() )   {
     G4AutoLock protection_lock(&kernel_mutex);    {
-      if ( 0 == s_main_instance.get() )   { // Need to check again!
+      if ( nullptr == s_main_instance.get() )   { // Need to check again!
         /// Install here the termination handler
         std::set_terminate(description_unexpected);
-        s_main_instance.adopt(new Geant4Kernel(description));
+        s_main_instance.reset(new Geant4Kernel(description));
       }
     }
   }
diff --git a/DDG4/src/Geant4PlacementParameterisation.cpp b/DDG4/src/Geant4PlacementParameterisation.cpp
index 429174d533af36eedc286369b01cd4850d7cbc73..77bcdb33191f51a201d7e2c8dd2fb7540264483c 100644
--- a/DDG4/src/Geant4PlacementParameterisation.cpp
+++ b/DDG4/src/Geant4PlacementParameterisation.cpp
@@ -86,15 +86,20 @@ void dd4hep::sim::Geant4PlacementParameterisation::ComputeTransformation(const G
   if ( !m_have_rotation )    {
     G4ThreeVector tra = m_start.translation;
     if ( nd >= 1 )   {
-      std::size_t d1 = (nd == 1) ? copy : (nd >= 2 ? copy%dim[1].count : 0);
+      std::size_t d1 = 0;
+      if (nd == 1) d1 = copy;
+      else if (nd >= 2) d1 = copy%dim[1].count;
       tra = tra + (dim[0].translation * d1);
     }
     if ( nd >= 2 )   {
-      std::size_t d2 = (nd == 2) ? copy / dim[0].count : (nd >= 3 ? copy%dim[2].count / dim[0].count : 0);
+      std::size_t d2 = 0;
+      if (nd == 2) d2 = copy / dim[0].count;
+      else if (nd >= 3 ) d2 = copy%dim[2].count / dim[0].count;
       tra = tra + (dim[1].translation * d2);
     }
     if ( nd >= 3 )   {
-      std::size_t d3 = (nd == 3) ? copy / (dim[0].count*dim[1].count) : 0;
+      std::size_t d3 = 0;
+      if ( nd == 3 ) d3 = copy / (dim[0].count*dim[1].count);
       tra = tra + (dim[2].translation * d3);
     }
     pv->SetTranslation(tra);
diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp
index 3de8ab5ea88c3ec3582737bd74df303f10cabc68..cb6e8ec1ca3f7dd3ac89dccf0ea48c5742c6e701 100644
--- a/DDG4/src/Geant4SensDetAction.cpp
+++ b/DDG4/src/Geant4SensDetAction.cpp
@@ -278,11 +278,10 @@ long long int Geant4Sensitive::cellID(const G4Step* step) {
 	    local.x(), local.y(), local.z(), global.x(), global.y(), global.z());
       error("....... TGeo-local: (%f, %f, %f) TGeo-global: (%f, %f, %f)",
 	    loc.x(), loc.y(), loc.z(), glob.x(), glob.y(), glob.z());
-      if ( h.pre )
-        error("....... Pre-step:  %s  SD: %s", h.volName(h.pre), h.sdName(h.pre).c_str());
+      error("....... Pre-step:  %s  SD: %s", h.volName(h.pre), h.sdName(h.pre).c_str());
       if ( h.post )
-	error("....... Post-step: %s  SD: %s", h.volName(h.post), h.sdName(h.post).c_str());
-      std::rethrow_exception(eptr);
+        error("....... Post-step: %s  SD: %s", h.volName(h.post), h.sdName(h.post).c_str());
+      std::rethrow_exception(std::move(eptr));
     }
   }
   return volID;