diff --git a/DDCore/include/DD4hep/Factories.h b/DDCore/include/DD4hep/Factories.h
index e70b9aff44af4c39cd3b199052002a1dc57235b7..7be5a22c5b8372983cb178c16cd6ae0b6c8b4333 100644
--- a/DDCore/include/DD4hep/Factories.h
+++ b/DDCore/include/DD4hep/Factories.h
@@ -220,9 +220,9 @@ namespace {
 
   DD4HEP_PLUGIN_FACTORY_ARGS_3(long,dd4hep::Detector*,int,char**)  {
     static long ret;
-    ret = dd4hep::ApplyFactory<P>::create(*a0,a1,a2);
-    //return dd4hep::PluginFactoryBase::make_return<long>(ret);
-    return (long)&ret;
+    long result = dd4hep::ApplyFactory<P>::create(*a0,a1,a2);
+    ret = result;
+    return long(&ret);
   }
 
   DD4HEP_PLUGIN_FACTORY_ARGS_2(ns::Named*,dd4hep::Detector*,ns::xml_h*)
@@ -233,8 +233,8 @@ namespace {
 
   DD4HEP_PLUGIN_FACTORY_ARGS_2(long,dd4hep::Detector*,ns::xml_h*)    {
     static long ret;
-    ret = dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1);
-    //return dd4hep::PluginFactoryBase::make_return<long>(ret);
+    long result = dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1);
+    ret = result;
     return long(&ret);
   }
 
diff --git a/DDCore/include/DD4hep/Plugins.h b/DDCore/include/DD4hep/Plugins.h
index e071c75d5a07cb4d861ec56b8fe7ce6e13f14d8f..e29df7410aaae288e446817939a21c8488fac8aa 100644
--- a/DDCore/include/DD4hep/Plugins.h
+++ b/DDCore/include/DD4hep/Plugins.h
@@ -55,7 +55,6 @@ namespace dd4hep {
     template <typename T> static T  val(const T* _p)     { return T(*_p);  }
     template <typename T> static T value(const void* _p) { return (T)_p;   }
     static const char*  value(const void* _p) { return (const char*)(_p);  }
-    //template <typename T> static T make_return(const T& _p);// { return _p;      }
   };
   template <> inline int PluginFactoryBase::value<int>(const void* _p) { return *(int*)(_p); }
   template <> inline long PluginFactoryBase::value<long>(const void* _p) { return *(long*)(_p); }
@@ -142,12 +141,6 @@ namespace {
   /// Base factory template
   template <typename P, typename S> class Factory {};
 }
-#if 0
-namespace dd4hep {
-  template <> inline long PluginFactoryBase::make_return(const long& value)
-  { static long stored=value; return (long)&stored; }  
-}
-#endif
 
 #define DD4HEP_FACTORY_CALL(type,name,signature) dd4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::call)
 #define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(X,Y)
diff --git a/DDG4/include/DDG4/Factories.h b/DDG4/include/DDG4/Factories.h
index 681e2ad4232371f30670ca822a9ba1509d92dbfd..3e87259e12da8faf0484b36a34b0b7f2e65b9bd7 100644
--- a/DDG4/include/DDG4/Factories.h
+++ b/DDG4/include/DDG4/Factories.h
@@ -85,7 +85,8 @@ namespace {
 
   DD4HEP_PLUGIN_FACTORY_ARGS_3(long, dd4hep::Detector*, const _ns::GH*, const _ns::STRM*)   {
     static long ret;
-    ret = dd4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2);
+    long result = dd4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2);
+    ret = result;
     return long(&ret);
   }
   /// Factory to create Geant4 sensitive detectors
diff --git a/examples/CLICSiD/scripts/CLICSiDAClick.C b/examples/CLICSiD/scripts/CLICSiDAClick.C
index 9cc3ff7db0d9c3cbfb411efb5c170aa1f64af9c1..d1a522409dbbef0ded7f56f284db37c41d9a2d57 100644
--- a/examples/CLICSiD/scripts/CLICSiDAClick.C
+++ b/examples/CLICSiD/scripts/CLICSiDAClick.C
@@ -56,6 +56,7 @@ int setupG4_CINT(bool interactive)  {
   kernel.loadGeometry(("file:"+det_dir+"/DDDetectors/compact/SiD.xml").c_str());
   kernel.loadXML(("file:"+install_dir+"/examples/CLICSiD/sim/field.xml").c_str());
 
+  kernel.property("NumEvents") = 10;
   if ( interactive )   {
     kernel.property("UI") = "UI";
     setPrintLevel(DEBUG);
diff --git a/examples/CLICSiD/scripts/CLICSiDXML.C b/examples/CLICSiD/scripts/CLICSiDXML.C
index 39522c94603ec5ce3678304f5cb0ed6e962cbe9c..d61d5b4ff84d6e1ca7b39d6c51ceb5fa0ff569ed 100644
--- a/examples/CLICSiD/scripts/CLICSiDXML.C
+++ b/examples/CLICSiD/scripts/CLICSiDXML.C
@@ -40,6 +40,7 @@ int setupG4_XML(bool interactive)  {
   kernel.loadXML((prefix+"CLICSiD/sim/field.xml").c_str());
   kernel.loadXML((prefix+"CLICSiD/sim/sequences.xml").c_str());
   kernel.loadXML((prefix+"CLICSiD/sim/physics.xml").c_str());
+  kernel.property("NumEvents") = 10;
   if ( interactive )  {
     kernel.property("UI") = "UI";
   }