diff --git a/src/digest-tree-scene.cpp b/src/digest-tree-scene.cpp
index 14f95bd..b885714 100644
--- a/src/digest-tree-scene.cpp
+++ b/src/digest-tree-scene.cpp
@@ -38,14 +38,18 @@
   bool rePlot = false; 
   for (int i = 0; i < n; i++) 
   {
-    Roster_iterator it = m_roster.find(v[i].prefix.c_str());
+    QString routablePrefix(v[i].prefix.c_str());
+    QString prefix = trimRoutablePrefix(routablePrefix);
+
+    Roster_iterator it = m_roster.find(prefix);
     if (it == m_roster.end()) 
     {
+      // std::cout << "processUpdate v[" << i << "]: " << prefix.toStdString() << std::endl;
       rePlot = true; 
       DisplayUserPtr p(new DisplayUser());
       time_t tempTime = time(NULL) - FRESHNESS + 1;
       p->setReceived(tempTime);
-      p->setPrefix(v[i].prefix.c_str());
+      p->setPrefix(prefix);
       p->setSeq(v[i].high);
       m_roster.insert(p->getPrefix(), p);
     }
@@ -64,7 +68,10 @@
   {
     for (int i = 0; i < n; i++) 
     {
-      Roster_iterator it = m_roster.find(v[i].prefix.c_str());
+      QString routablePrefix(v[i].prefix.c_str());
+      QString prefix = trimRoutablePrefix(routablePrefix);
+    
+      Roster_iterator it = m_roster.find(prefix);
       if (it != m_roster.end()) {
         DisplayUserPtr p = it.value();
         QGraphicsTextItem *item = p->getSeqTextItem();
@@ -104,17 +111,19 @@
 }
 
 void
-DigestTreeScene::msgReceived(QString prefix, QString nick)
+DigestTreeScene::msgReceived(QString routablePrefix, QString nick)
 {
+  QString prefix = trimRoutablePrefix(routablePrefix);
   Roster_iterator it = m_roster.find(prefix);
+  // std::cout << "msgReceived prefix: " << prefix.toStdString() << std::endl;
   if (it != m_roster.end()) 
     {
-      std::cout << "Updating for prefix = " << prefix.toStdString() << " nick = " << nick.toStdString() << std::endl;
+      // std::cout << "Updating for prefix = " << prefix.toStdString() << " nick = " << nick.toStdString() << std::endl;
       DisplayUserPtr p = it.value();
       p->setReceived(time(NULL));
       if (nick != p->getNick()) 
         {
-          std::cout << "old nick = " << p->getNick().toStdString() << std::endl;
+          // std::cout << "old nick = " << p->getNick().toStdString() << std::endl;
           p->setNick(nick);
           QGraphicsTextItem *nickItem = p->getNickTextItem();
           QGraphicsRectItem *nickRectItem = p->getNickRectItem();
@@ -325,6 +334,33 @@
     seqTextItem->setPos(innerBR.x() + (innerBR.width() - textBR.width())/2, innerBR.y() + (innerBR.height() - textBR.height())/2);
 }
 
+QString 
+DigestTreeScene::trimRoutablePrefix(QString prefix)
+{
+  bool encaped = false;
+  ndn::Name prefixName(prefix.toStdString());
+
+  ndn::Name::const_iterator it  = prefixName.begin();
+  ndn::Name::const_iterator end = prefixName.end();
+  size_t offset = 0;
+
+  for(; it != end; it++, offset++)
+    {
+      if(it->toEscapedString() == "%F0.")
+        {
+          encaped = true;
+          break;
+        }
+    }
+
+  if(!encaped)
+    return prefix;
+  else
+    {
+      return QString(prefixName.getSubName(offset+1).toUri().c_str());
+    }
+}
+
 #if WAF
 #include "digest-tree-scene.moc"
 #include "digest-tree-scene.cpp.moc"
