diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp
index 1192a8f568822bc8518938e1aa1a220698abf82f..5015d7240a50fcfc0988f1f5d5adb146c2c0c049 100644
--- a/DDCore/src/DetectorImp.cpp
+++ b/DDCore/src/DetectorImp.cpp
@@ -701,10 +701,11 @@ void DetectorImp::dump() const {
 long DetectorImp::apply(const char* factory_type, int argc, char** argv)   const   {
   string fac = factory_type;
   try {
-    long result = PluginService::Create<long>(fac, (Detector*) this, argc, argv);
+    Detector* thisPtr = const_cast<DetectorImp*>(this);
+    long result = PluginService::Create<long>(fac, thisPtr, argc, argv);
     if (0 == result) {
       PluginDebug dbg;
-      result = PluginService::Create<long>(fac, (Detector*) this, argc, argv);
+      result = PluginService::Create<long>(fac, thisPtr, argc, argv);
       if ( 0 == result )  {
         throw runtime_error("dd4hep: apply-plugin: Failed to locate plugin " +
                             fac + ". " + dbg.missingFactory(fac));
diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp
index fcfba4fbb4d609e924be8dbccf640b5cd975f953..739c17956c702077d93b0483c7c9b99646dc1abf 100644
--- a/DDG4/src/Geant4Converter.cpp
+++ b/DDG4/src/Geant4Converter.cpp
@@ -1042,7 +1042,8 @@ void Geant4Converter::handleProperties(Detector::Properties& prp) const {
     const Detector::PropertyValues& vals = prp[nam];
     string type = vals.find("type")->second;
     string tag = type + "_Geant4_action";
-    long result = PluginService::Create<long>(tag, &m_detDesc, hdlr, &vals);
+    Detector* detPtr = const_cast<Detector*>(&m_detDesc);
+    long result = PluginService::Create<long>(tag, detPtr, hdlr, &vals);
     if (0 == result) {
       throw runtime_error("Failed to locate plugin to interprete files of type"
                           " \"" + tag + "\" - no factory:" + type);