diff --git a/pykd/pykd_vc120.vcxproj b/pykd/pykd_vc120.vcxproj
index 4832934..9ef9f46 100644
--- a/pykd/pykd_vc120.vcxproj
+++ b/pykd/pykd_vc120.vcxproj
@@ -91,7 +91,7 @@
     <LinkIncremental>false</LinkIncremental>
     <TargetExt>.pyd</TargetExt>
     <TargetName>$(ProjectName)</TargetName>
-    <IntDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</IntDir>
+    <IntDir>$(Platform)\$(Configuration)\</IntDir>
     <OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'">
@@ -99,7 +99,7 @@
     <TargetExt>.pyd</TargetExt>
     <TargetName>$(ProjectName)</TargetName>
     <OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</IntDir>
+    <IntDir>$(Platform)\$(Configuration)\</IntDir>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
     <ClCompile>
diff --git a/pykd/pykdver.h b/pykd/pykdver.h
index 4af3f07..75a2745 100644
--- a/pykd/pykdver.h
+++ b/pykd/pykdver.h
@@ -2,7 +2,7 @@
 #define PYKD_VERSION_MAJOR      0
 #define PYKD_VERSION_MINOR      3
 #define PYKD_VERSION_SUBVERSION 0
-#define PYKD_VERSION_BUILDNO    22
+#define PYKD_VERSION_BUILDNO    23
 
 #define __VER_STR2__(x) #x
 #define __VER_STR1__(x) __VER_STR2__(x)
diff --git a/pykd_bootstrapper/version.h b/pykd_bootstrapper/version.h
index bea5853..bdad861 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    3
+#define PYKDEXT_VERSION_BUILDNO    5
 
 #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 0211a25..dd601c9 100644
--- a/pykd_bootstrapper/windbgext.cpp
+++ b/pykd_bootstrapper/windbgext.cpp
@@ -24,8 +24,6 @@ public:
 
 private:
 
-    void startConsole();
-
     void printUsage();
     
     void printException();
@@ -154,17 +152,17 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, py)
             return;
         }
         else
-            if (args[0] == "-g" || args[0] == "--global")
-            {
-                global = true;
-                args.erase(args.begin());
-            }
-            else
-                if (args[0] == "-l" || args[0] == "--local")
-                {
-                    local = true;
-                    args.erase(args.begin());
-                }
+        if (args[0] == "-g" || args[0] == "--global")
+        {
+            global = true;
+            args.erase(args.begin());
+        }
+        else
+        if (args[0] == "-l" || args[0] == "--local")
+        {
+            local = true;
+            args.erase(args.begin());
+        }
     }
 
     PyThreadState   *localState = NULL;
@@ -172,88 +170,93 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, py)
 
     PyEval_RestoreThread(m_pyState);
 
-    python::handle<>  pykdHandle(python::allow_null(PyImport_ImportModule("pykd")));
-    if (!pykdHandle)
-    {
-        m_pyState = PyEval_SaveThread();
-        kdlib::eprintln(L"Pykd package is not installed. You can install it by command \"!pykd.install\"");
-        return;
-    }
+    try {
 
-    std::string  scriptFileName;
-    if (args.size() > 0)
-    {
-        scriptFileName = getScriptFileName(args[0]);
+        InterruptWatch  interruptWatch;
 
-        if (scriptFileName.empty())
+
+        std::string  scriptFileName;
+        if (args.size() > 0)
         {
-            m_pyState = PyEval_SaveThread();
-            kdlib::eprintln(L"script file not found");
-            return;
-        }
+            scriptFileName = getScriptFileName(args[0]);
 
-        global = !(global || local) ? false : global; //set local by default
-    }
-    else
-    {
-        global = !(global || local) ? true : global; //set global by default
-    }
-
-    if (!global)
-    {
-        globalState = PyThreadState_Swap(NULL);
-
-        Py_NewInterpreter();
-
-        localState = PyThreadState_Get();
-
-        python::object       sys = python::import("sys");
-
-        sys.attr("stdout") = python::object(::DbgOut());
-        sys.attr("stderr") = python::object(::DbgOut());
-        sys.attr("stdin") = python::object(::DbgIn());
-    }
-
-    if (args.size() == 0)
-    {
-        startConsole();
-    }
-    else
-    {
-        // �������������� ����������� ���������
-        char  **pythonArgs = new char*[args.size()];
-
-        pythonArgs[0] = const_cast<char*>(scriptFileName.c_str());
-
-        for (size_t i = 1; i < args.size(); ++i)
-            pythonArgs[i] = const_cast<char*>(args[i].c_str());
-
-        PySys_SetArgv((int)args.size(), pythonArgs);
-
-        delete[]  pythonArgs;
-
-        // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
-        python::object  main = python::import("__main__");
-
-        python::object  global(main.attr("__dict__"));
-
-        try {
-            InterruptWatch  interruptWatch;
-
-            if (!m_pykdInitialized)
+            if (scriptFileName.empty())
             {
-                python::exec("__import__('pykd').initialize()", global);
-                m_pykdInitialized = true;
+                m_pyState = PyEval_SaveThread();
+
+                kdlib::eprintln(L"script file not found");
+
+                return;
             }
 
-            python::exec_file(scriptFileName.c_str(), global);
+            global = !(global || local) ? false : global; //set local by default
         }
-        catch (python::error_already_set const &)
+        else
         {
-            printException();
+            global = !(global || local) ? true : global; //set global by default
+        }
+
+        if (!global)
+        {
+            globalState = PyThreadState_Swap(NULL);
+
+            Py_NewInterpreter();
+
+            localState = PyThreadState_Get();
+
+            python::object       sys = python::import("sys");
+
+            sys.attr("stdout") = python::object(::DbgOut());
+            sys.attr("stderr") = python::object(::DbgOut());
+            sys.attr("stdin") = python::object(::DbgIn());
+        }
+
+        // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
+        python::object       main = python::import("__main__");
+        python::object       globalScope(main.attr("__dict__"));
+
+
+        if (!m_pykdInitialized)
+        {
+            python::handle<>  pykdHandle(python::allow_null(PyImport_ImportModule("pykd")));
+            if (!pykdHandle)
+            {
+                PyErr_SetString(PyExc_Exception, "Pykd package is not installed. You can install it by command \"!pykd.install\"");
+                python::throw_error_already_set();
+            }
+
+            python::exec("__import__('pykd').initialize()", globalScope);
+            m_pykdInitialized = true;
+        }
+
+        if (args.size() == 0)
+        {
+            python::exec("import pykd", globalScope);
+            python::exec("from pykd import *", globalScope);
+            python::exec("__import__('code').InteractiveConsole(__import__('__main__').__dict__).interact()", globalScope);
+        }
+        else
+        {
+            // �������������� ����������� ���������
+            char  **pythonArgs = new char*[args.size()];
+
+            pythonArgs[0] = const_cast<char*>(scriptFileName.c_str());
+
+            for (size_t i = 1; i < args.size(); ++i)
+                pythonArgs[i] = const_cast<char*>(args[i].c_str());
+
+            PySys_SetArgv((int)args.size(), pythonArgs);
+
+            delete[]  pythonArgs;
+
+            python::exec_file(scriptFileName.c_str(), globalScope);
         }
     }
-
+    catch (python::error_already_set const &)
+    {
+        printException();
+    }
+    
     if (!global)
     {
         PyInterpreterState  *interpreter = localState->interp;
@@ -277,6 +280,7 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, py)
     }
 
     m_pyState = PyEval_SaveThread();
+
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -285,12 +289,13 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, install)
 {
     PyEval_RestoreThread(m_pyState);
 
-    // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
-    python::object       main = python::import("__main__");
-
-    python::object       global(main.attr("__dict__"));
-
     try {
+
+        // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
+        python::object       main = python::import("__main__");
+
+        python::object       global(main.attr("__dict__"));
+        
         InterruptWatch  interruptWatch;
 
         python::exec("import pip\n", global);
@@ -312,14 +317,15 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, upgrade)
 {
     PyEval_RestoreThread(m_pyState);
 
-    // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
-    python::object       main = python::import("__main__");
-
-    python::object       global(main.attr("__dict__"));
-
     try {
+
         InterruptWatch  interruptWatch;
 
+        // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
+        python::object       main = python::import("__main__");
+
+        python::object       global(main.attr("__dict__"));
+
         python::exec("import pip\n", global);
         python::exec("pip.logger.consumers = []\n", global);
         python::exec("pip.main(['install', '--upgrade', 'pykd'])\n", global);
@@ -372,41 +378,21 @@ void PykdBootsTrapper::tearDown()
 {
     PyEval_RestoreThread(m_pyState);
 
-    Py_Finalize();
+    if (m_pykdInitialized)
+    {
+        python::object       main = python::import("__main__");
+        python::object       globalScope(main.attr("__dict__"));
+        python::exec("__import__('pykd').deinitialize()", globalScope);
+        m_pykdInitialized = false;
+    }
+
+  //  Py_Finalize();
 
     WindbgExtension::tearDown();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void PykdBootsTrapper::startConsole()
-{
-
-    // �������� ������ � ����������� ���� ( ����� ��� ������ exec_file )
-    python::object       main = python::import("__main__");
-
-    python::object       global(main.attr("__dict__"));
-
-    try {
-        InterruptWatch  interruptWatch;
-
-        python::exec("import pykd", global);
-        python::exec("from pykd import *", global);
-        if (!m_pykdInitialized)
-        {
-            python::exec("pykd.initialize()", global);
-            m_pykdInitialized = true;
-        }
-        python::exec("__import__('code').InteractiveConsole(__import__('__main__').__dict__).interact()\n", global);
-    }
-    catch (python::error_already_set const &)
-    {
-        printException();
-    }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
 void PykdBootsTrapper::printUsage()
 {
     kdlib::dprintln(L"usage:");