diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index bce46a013079067039097a379e4b9dfc79ea6a4a..1881dae46c12cd08ff1fcf14523063e72758215a 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -2247,20 +2247,24 @@ AccountMap ManagerImpl::getSipAccountMap( void )
 
 void ManagerImpl::restartPJSIP (void)
 {
-    SIPVoIPLink *siplink;
+    //SIPVoIPLink *siplink;
+
+    //unloadAccountMap ();
 
     /* First unregister all SIP accounts */
-    this->unregisterCurSIPAccounts();
+    //this->unregisterCurSIPAccounts();
     /* Terminate and initialize the PJSIP library */
-    siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ());
-    if (siplink) 
-    {
-        siplink->terminate ();
-        _debug ("*************************************************Terminate done\n");
+    //siplink = dynamic_cast<SIPVoIPLink*> (getSIPAccountLink ());
+    //if (siplink) 
+    //{
+      //  siplink->terminate ();
+       // _debug ("*************************************************Terminate done\n");
         //siplink = SIPVoIPLink::instance("");
-        siplink->init ();
-    }
-    _debug("***************************************************Init Done\n");
+        //siplink->init ();
+    //}
+    //_debug("***************************************************Init Done\n");
+    //loadAccountMap();
+    //initRegisterAccounts ();
     /* Then register all enabled SIP accounts */
     //this->registerCurSIPAccounts(siplink);
 }
@@ -2326,7 +2330,7 @@ void ManagerImpl::registerCurSIPAccounts(VoIPLink *link)
         current = iter->second;
         if (current) {
             if ( current->isEnabled() && current->getType() == "sip") {
-                current->setVoIPLink(link);
+                //current->setVoIPLink(link);
 	            current->registerVoIPLink();
             }
         }
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index bb25efcbefd2fc7ecb06925dffbdd760083aed95..3197382dab7166dec1564c998d46abfd2f3ec144 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -233,7 +233,6 @@ SIPVoIPLink::terminateSIPCall()
     void
 SIPVoIPLink::getEvent()
 {
-    _debug("a");
     // We have to register the external thread so it could access the pjsip framework
     if(!pj_thread_is_registered())
         pj_thread_register( NULL, desc, &thread );
@@ -1326,10 +1325,13 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
 
     bool SIPVoIPLink::pjsip_shutdown( void )
     {
-        /*if (_endpt) {
+        if (_endpt) {
             _debug("UserAgent: Shutting down...\n");
             busy_sleep(1000);
-        }*/
+        }
+
+        pj_thread_destroy( thread );
+        thread = NULL;
 
         /* Destroy endpoint. */
         if (_endpt) {