diff --git a/pykd/cpureg.cpp b/pykd/cpureg.cpp
index ce5d80a..ee61890 100644
--- a/pykd/cpureg.cpp
+++ b/pykd/cpureg.cpp
@@ -65,4 +65,39 @@ python::object getRegByName( const std::wstring &regName )
 
 ///////////////////////////////////////////////////////////////////////////////////
 
+ULONG64 DebugClient::loadMSR( ULONG  msr )
+{
+    HRESULT     hres;
+    ULONG64     value;
+
+    hres = m_dataSpaces->ReadMsr( msr, &value );
+    if ( FAILED( hres ) )
+         throw DbgException( "IDebugDataSpaces::ReadMsr  failed" );
+
+    return value;
+}
+
+ULONG64 loadMSR( ULONG  msr )
+{
+    return g_dbgClient->loadMSR( msr );
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+
+void DebugClient::setMSR( ULONG msr, ULONG64 value)
+{
+    HRESULT     hres;
+
+    hres = m_dataSpaces->WriteMsr(msr, value);
+    if ( FAILED( hres ) )
+         throw DbgException( "IDebugDataSpaces::WriteMsr  failed" );
+}
+
+void setMSR( ULONG msr, ULONG64 value)
+{
+    g_dbgClient->setMSR( msr, value );
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+
 } // end namespace pykd
\ No newline at end of file
diff --git a/pykd/cpureg.h b/pykd/cpureg.h
index 99f6c9e..05b445d 100644
--- a/pykd/cpureg.h
+++ b/pykd/cpureg.h
@@ -11,6 +11,10 @@ python::object getRegByName( const std::wstring &regName );
 
 python::object getRegByIndex( ULONG index );
 
+ULONG64 loadMSR( ULONG  msr );
+
+void setMSR( ULONG msr, ULONG64 value);
+
 ///////////////////////////////////////////////////////////////////////////////////
 
 }; // end pykd namespace
diff --git a/pykd/dbgclient.cpp b/pykd/dbgclient.cpp
index dc5cfdb..fad59df 100644
--- a/pykd/dbgclient.cpp
+++ b/pykd/dbgclient.cpp
@@ -179,25 +179,6 @@ void loadDump( const std::wstring &fileName ) {
 
 ///////////////////////////////////////////////////////////////////////////////////
 
-ULONG64 DebugClient::loadMSR( ULONG  msr )
-{
-    HRESULT     hres;
-    ULONG64     value;
-
-    hres = m_dataSpaces->ReadMsr( msr, &value );
-    if ( FAILED( hres ) )
-         throw DbgException( "IDebugDataSpaces::ReadMsr  failed" );
-
-    return value;
-}
-
-ULONG64 loadMSR( ULONG  msr )
-{
-    return g_dbgClient->loadMSR( msr );
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-
 void DebugClient::startProcess( const std::wstring  &processName )
 {
     HRESULT     hres;
@@ -370,22 +351,6 @@ void setExecutionStatus( ULONG status )
 
 ///////////////////////////////////////////////////////////////////////////////////
 
-void DebugClient::setMSR( ULONG msr, ULONG64 value)
-{
-    HRESULT     hres;
-
-    hres = m_dataSpaces->WriteMsr(msr, value);
-    if ( FAILED( hres ) )
-         throw DbgException( "IDebugDataSpaces::WriteMsr  failed" );
-}
-
-void setMSR( ULONG msr, ULONG64 value)
-{
-    g_dbgClient->setMSR( msr, value );
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-
 void DebugClient::waitForEvent()
 {
     HRESULT     hres;
diff --git a/pykd/dbgclient.h b/pykd/dbgclient.h
index 16ca1c0..c6f9b52 100644
--- a/pykd/dbgclient.h
+++ b/pykd/dbgclient.h
@@ -304,14 +304,10 @@ bool isKernelDebugging();
 
 bool isDumpAnalyzing();
 
-ULONG64 loadMSR( ULONG  msr );
-
 ULONG ptrSize();
 
 void setExecutionStatus( ULONG status );
 
-void setMSR( ULONG msr, ULONG64 value);
-
 void terminateProcess();
 
 void waitForEvent();
diff --git a/pykd/intbase.h b/pykd/intbase.h
index 6a07c7c..5d9f1ee 100644
--- a/pykd/intbase.h
+++ b/pykd/intbase.h
@@ -195,20 +195,15 @@ private:
 
             return BaseTypeVariant(false);
         }
-        else if ( _PyLong_Sign( obj.ptr() ) >= 0 )
+        else if ( PyInt_CheckExact( obj.ptr() ) )
         {
-            if ( PyInt_CheckExact( obj.ptr() ) )
-                return BaseTypeVariant( ULONG( PyLong_AsUnsignedLong( obj.ptr() ) ) );
-            else
-            if( PyLong_CheckExact( obj.ptr() ) )
-                return BaseTypeVariant( ULONG64( PyLong_AsUnsignedLongLong( obj.ptr() ) ) );
+             return BaseTypeVariant( LONG( PyLong_AsLong( obj.ptr() ) ) );
         }
         else
         {
-            if ( PyInt_CheckExact( obj.ptr() ) )
-                return BaseTypeVariant( LONG( PyLong_AsLong( obj.ptr() ) ) );
+            if ( _PyLong_Sign( obj.ptr() ) >= 0 )
+                return BaseTypeVariant( ULONG64( PyLong_AsUnsignedLongLong( obj.ptr() ) ) );
             else
-            if( PyLong_CheckExact( obj.ptr() ) )
                 return BaseTypeVariant( LONG64( PyLong_AsLongLong( obj.ptr() ) ) );
         }
 
diff --git a/test/scripts/intbase.py b/test/scripts/intbase.py
index da8a9b2..b451760 100644
--- a/test/scripts/intbase.py
+++ b/test/scripts/intbase.py
@@ -26,6 +26,7 @@ class IntBaseTest( unittest.TestCase ):
         self.assertTrue( 0xFFFFFFFFFFFFFFFF ==  intBase(0xFFFFFFFFFFFFFFFF) )
         self.assertTrue( -20 == intBase(-20) )
         self.assertTrue( -2000 == intBase(-2000) )
+        self.assertTrue( -0x7FFFFFFF == intBase(-0x7FFFFFFF) )
         self.assertTrue( -20000000000 == intBase(-20000000000) )         
         self.assertTrue( -0x8000000000000000 == intBase(-0x8000000000000000) )
         self.assertTrue( intBase(0x20L) == intBase(0x20) )