diff --git a/pykd_bootstrapper/version.h b/pykd_bootstrapper/version.h
index ab3ac3c..b70f446 100644
--- a/pykd_bootstrapper/version.h
+++ b/pykd_bootstrapper/version.h
@@ -3,7 +3,7 @@
 #define PYKDEXT_VERSION_MAJOR      1
 #define PYKDEXT_VERSION_MINOR      0
 #define PYKDEXT_VERSION_SUBVERSION 1
-#define PYKDEXT_VERSION_BUILDNO    12
+#define PYKDEXT_VERSION_BUILDNO    13
 
 #define __VER_STR2__(x) #x
 #define __VER_STR1__(x) __VER_STR2__(x)
diff --git a/pykd_bootstrapper/windbgext.cpp b/pykd_bootstrapper/windbgext.cpp
index 57079d2..7327304 100644
--- a/pykd_bootstrapper/windbgext.cpp
+++ b/pykd_bootstrapper/windbgext.cpp
@@ -190,6 +190,15 @@ public:
         delete m_globalInterpreter;
         m_globalInterpreter = 0;
         PyThreadState_Swap(m_globalState);
+
+        if (m_pykdInit)
+        {
+            python::object  main = python::import("__main__");
+            python::object  globalScope(main.attr("__dict__"));
+            python::exec("__import__('pykd').deinitialize()", globalScope);
+            m_pykdInit = false;
+        }
+
         m_globalState = PyEval_SaveThread();
     }
 
@@ -198,14 +207,6 @@ public:
         PyEval_RestoreThread(m_globalState);
 
         m_globalInterpreter = new PythonInterpreter();
-
-        //m_globalInterpreter->acivate();
-
-        //python::object  main = boost::python::import("__main__");
-
-        //python::object  main_namespace = main.attr("__dict__");
-
-        //m_globalInterpreter->deactivate();
     }
 
     void acivateGlobal() {