Correcting bugs. Previous way didn't really worked at all
diff --git a/chatdialog.cpp b/chatdialog.cpp
index 0067fd1..f9de0c3 100644
--- a/chatdialog.cpp
+++ b/chatdialog.cpp
@@ -76,6 +76,8 @@
                                        bind(&ChatDialog::processRemoveWrapper, this, _1));
       Sync::CcnxWrapperPtr handle = Sync::CcnxWrapper::Create();
       handle->setInterestFilter(m_user.getPrefix().toStdString(), bind(&ChatDialog::respondHistoryRequest, this, _1));
+      QTimer::singleShot(100, this, SLOT(getLocalPrefix()));
+
       QTimer::singleShot(600, this, SLOT(sendJoin()));
       m_timer->start(FRESHNESS * 2000);
       disableTreeDisplay();
@@ -579,19 +581,24 @@
 //     localPrefix = DEFAULT_LOCAL_PREFIX;
 //   }
 //   return localPrefix;
-
+  std::cerr << "trying to get local prefix" << std::endl;
+  
   if (m_sock != NULL)
     {
-      QString originPrefix = QString::fromStdString (m_sock->getLocalPrefix());
+      std::cerr << "trying to get local prefix2" << std::endl;
+      QString originPrefix = QString::fromStdString (m_sock->getLocalPrefix()).trimmed ();
+      std::cerr << "got: " << originPrefix.toStdString () << std::endl;
+
       if (originPrefix != "" && m_user.getOriginPrefix () != originPrefix)
         {
-          m_user.setOriginPrefix(originPrefix);
-          emit settingUpdated(m_user.getNick (), m_user.getChatroom (), m_user.getOriginPrefix ());
+          // m_user.setOriginPrefix(originPrefix);
+          emit settingUpdated(m_user.getNick (), m_user.getChatroom (), originPrefix);
           // connect(&dialog, SIGNAL(updated(QString, QString, QString)), this, SLOT());
         }
     }
   else
     {
+      std::cerr << "socket is not availble" << std::endl;
       // QTimer::singleShot(1000, this, SLOT(getLocalPrefix())); // try again
     }
 }
@@ -602,14 +609,13 @@
   QSettings s(ORGANIZATION, APPLICATION);
   QString nick = s.value("nick", "").toString();
   QString chatroom = s.value("chatroom", "").toString();
-  QString originPrefix = s.value("originPrefix", "").toString();
+  // QString originPrefix = s.value("originPrefix", "").toString();
 
   // Sync::CcnxWrapperPtr wrapper = Sync::CcnxWrapper::Create ();
   // QString originPrefix = QString::fromStdString (wrapper->getLocalPrefix());
   // Sync::CcnxWrapper::Destroy ();
-  // QString originPrefix = DEFAULT_LOCAL_PREFIX;
   
-  QTimer::singleShot(500, this, SLOT(getLocalPrefix()));
+  QString originPrefix = DEFAULT_LOCAL_PREFIX;
   
   m_minimaniho = s.value("minimaniho", false).toBool();
   if (nick == "" || chatroom == "" || originPrefix == "") {