diff --git a/src/contact-item.cpp b/src/contact-item.cpp
index eb342d6..839988c 100644
--- a/src/contact-item.cpp
+++ b/src/contact-item.cpp
@@ -28,34 +28,34 @@
   , m_isIntroducer(isIntroducer)
 {
   Name endorsedkeyName = selfEndorseCertificate.getPublicKeyName();
-  Ptr<const signature::Sha256WithRsa> endorseSig = boost::dynamic_pointer_cast<const signature::Sha256WithRsa>(selfEndorseCertificate.getSignature());
-  const Name& signingKeyName = endorseSig->getKeyLocator().getKeyName();
+  // Ptr<const signature::Sha256WithRsa> endorseSig = boost::dynamic_pointer_cast<const signature::Sha256WithRsa>(selfEndorseCertificate.getSignature());
+  // const Name& signingKeyName = endorseSig->getKeyLocator().getKeyName();
   
-  int i = 0;
-  int j = -1;
-  string keyString("KEY");
-  string idString("ID-CERT");
-  for(; i < signingKeyName.size(); i++)
-    {
-      if(keyString == signingKeyName.get(i).toUri())
-        j = i;
-      if(idString == signingKeyName.get(i).toUri())
-        break;
-    }
+  // int i = 0;
+  // int j = -1;
+  // string keyString("KEY");
+  // string idString("ID-CERT");
+  // for(; i < signingKeyName.size(); i++)
+  //   {
+  //     if(keyString == signingKeyName.get(i).toUri())
+  //       j = i;
+  //     if(idString == signingKeyName.get(i).toUri())
+  //       break;
+  //   }
 
-  if(i >= signingKeyName.size() || j < 0)
-    throw LnException("Wrong name!");
+  // if(i >= signingKeyName.size() || j < 0)
+  //   throw LnException("Wrong name!");
 
-  Name subName = signingKeyName.getSubName(0, j);
-  subName.append(signingKeyName.getSubName(j+1, i-j-1));
+  // Name subName = signingKeyName.getSubName(0, j);
+  // subName.append(signingKeyName.getSubName(j+1, i-j-1));
 
 
 
-  // _LOG_DEBUG("endorsedkeyName " << endorsedkeyName.toUri());
-  // _LOG_DEBUG("subKeyName " << subName.toUri());
+  // // _LOG_DEBUG("endorsedkeyName " << endorsedkeyName.toUri());
+  // // _LOG_DEBUG("subKeyName " << subName.toUri());
 
-  if(endorsedkeyName != subName)
-    throw LnException("not a self-claimed");
+  // if(endorsedkeyName != subName)
+  //   throw LnException("not a self-claimed");
 
   m_namespace = endorsedkeyName.getSubName(0, endorsedkeyName.size() - 1);
   m_alias = alias.empty() ? m_namespace.toUri() : alias;
