diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6709408b4cd21467daa8c9a7c69df86906dc477..f37d345a788fa3dd3c66e616b3bbfc9f34354ddd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,7 +108,6 @@ ENDFOREACH(header)
 SET(${PROJECT_NAME}_SOURCES
   src/exception.cpp
   src/eigenpy.cpp
-  src/details.cpp
   src/angle-axis.cpp
   src/quaternion.cpp
 )
diff --git a/src/details.cpp b/src/details.cpp
deleted file mode 100644
index c77a0be89a4f903c1d53ec96b7446dacac78fe75..0000000000000000000000000000000000000000
--- a/src/details.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2015 LAAS-CNRS
- *
- * This file is part of eigenpy.
- * eigenpy is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- * eigenpy is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.  You should
- * have received a copy of the GNU Lesser General Public License along
- * with eigenpy.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "eigenpy/details.hpp"
-
-namespace eigenpy
-{
-  PyMatrixType pyMatrixType = PyMatrixType();
-} // namespace eigenpy
diff --git a/src/details.hpp b/src/details.hpp
index 8989f30370c2d361e081e12a668f4552319ce4dd..2c724f85cf2f983b502b1d6a7a28b0134bdbd830 100644
--- a/src/details.hpp
+++ b/src/details.hpp
@@ -35,31 +35,39 @@ namespace eigenpy
   template <> struct NumpyEquivalentType<int>     { enum { type_code = NPY_INT    };};
   template <> struct NumpyEquivalentType<float>   { enum { type_code = NPY_FLOAT  };};
 
+  namespace bp = boost::python;
+
   struct PyMatrixType
   {
-    boost::python::object pyMatrixType;
-    boost::python::object pyModule;
 
-    PyMatrixType() 
+    static PyMatrixType & getInstance()
     {
-      pyModule = boost::python::import("numpy");
-      pyMatrixType = pyModule.attr("matrix");
+      static PyMatrixType instance;
+      return instance;
     }
-    operator boost::python::object () { return pyMatrixType; }
 
-    boost::python::object make(PyArrayObject* pyArray, bool copy = false)
+    operator bp::object () { return pyMatrixType; }
+
+    bp::object make(PyArrayObject* pyArray, bool copy = false)
     { return make((PyObject*)pyArray,copy); }
-    boost::python::object make(PyObject* pyObj, bool copy = false)
+    bp::object make(PyObject* pyObj, bool copy = false)
     {
       boost::python::object m
-	= pyMatrixType( boost::python::object(boost::python::handle<>(pyObj)), 
-			boost::python::object(), copy );
+      = pyMatrixType(bp::object(bp::handle<>(pyObj)), bp::object(), copy);
       Py_INCREF(m.ptr());
       return m;
     }
-  };
 
-  extern PyMatrixType pyMatrixType;
+  protected:
+    PyMatrixType()
+    {
+      pyModule = boost::python::import("numpy");
+      pyMatrixType = pyModule.attr("matrix");
+    }
+
+    bp::object pyMatrixType;
+    bp::object pyModule;
+  };
 
   /* --- TO PYTHON -------------------------------------------------------------- */
   template< typename MatType,typename EquivalentEigenType >
@@ -78,7 +86,7 @@ namespace eigenpy
 
       MapNumpy<EquivalentEigenType>::map(pyArray) = mat;
 
-      return pyMatrixType.make(pyArray).ptr();
+      return PyMatrixType::getInstance().make(pyArray).ptr();
     }
   };