diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 2b834c6..651ab82 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -232,11 +232,17 @@
   Name certificateName = identityManager->getDefaultCertificateName ();
   identityManager->signByCertificate(*profileData, certificateName);
 
-  EndorseCertificate endorseCertificate(identityCertificate, profileData);
+  Ptr<EndorseCertificate> endorseCertificate = NULL;
+  try{
+    endorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(identityCertificate, profileData));
+  }catch(exception& e){
+    _LOG_ERROR("Exception: " << e.what());
+    return;
+  }
 
-  identityManager->signByCertificate(endorseCertificate, certificateName);
+  identityManager->signByCertificate(*endorseCertificate, certificateName);
 
-  emit contactKeyFetched (endorseCertificate); 
+  emit contactKeyFetched (*endorseCertificate); 
 }
 
 void
@@ -250,7 +256,6 @@
 void
 ContactManager::updateProfileData(const Name& identity)
 {
-  // _LOG_DEBUG("updateProfileData: " << identity.toUri());
   // Get current profile;
   Ptr<Profile> newProfile = m_contactStorage->getSelfProfile(identity);
   if(NULL == newProfile)
@@ -261,19 +266,26 @@
   Ptr<Blob> profileDataBlob = m_contactStorage->getSelfEndorseCertificate(identity);
   if(NULL != profileDataBlob)
     {
-      Ptr<Data> plainData = Data::decodeFromWire(profileDataBlob);
-      EndorseCertificate oldEndorseCertificate(*plainData);    
-      // _LOG_DEBUG("Certificate converted!");
-      const Blob& oldProfileBlob = oldEndorseCertificate.getProfileData()->content();
+      
+      Ptr<EndorseCertificate> oldEndorseCertificate = NULL;
+      try{
+        Ptr<Data> plainData = Data::decodeFromWire(profileDataBlob);
+        oldEndorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(*plainData));
+      }catch(exception& e){
+        _LOG_ERROR("Exception: " << e.what());
+        return;
+      }
+
+      const Blob& oldProfileBlob = oldEndorseCertificate->getProfileData()->content();
 
       if(oldProfileBlob == *newProfileBlob)
         return;
 
       Ptr<EndorseCertificate> newEndorseCertificate = getSignedSelfEndorseCertificate(identity, *newProfile);
-      // _LOG_DEBUG("Signing DONE!");
+
       if(NULL == newEndorseCertificate)
         return;
-      // _LOG_DEBUG("About to update");
+
       m_contactStorage->updateSelfEndorseCertificate(newEndorseCertificate, identity);
 
       publishSelfEndorseCertificateInDNS(newEndorseCertificate);
@@ -281,10 +293,10 @@
   else
     {
       Ptr<EndorseCertificate> newEndorseCertificate = getSignedSelfEndorseCertificate(identity, *newProfile);
-      // _LOG_DEBUG("Signing DONE!");
+
       if(NULL == newEndorseCertificate)
         return;
-      // _LOG_DEBUG("About to Insert");
+
       m_contactStorage->addSelfEndorseCertificate(newEndorseCertificate, identity);
 
       publishSelfEndorseCertificateInDNS(newEndorseCertificate);
@@ -298,9 +310,15 @@
   Ptr<EndorseCertificate> newEndorseCertificate = generateEndorseCertificate(identity, signerIdentity);
   if(NULL != oldEndorseCertificateBlob)
     {
-      Ptr<Data> plainData = Data::decodeFromWire(oldEndorseCertificateBlob);
-      EndorseCertificate oldEndorseCertificate(*plainData);
-      const Blob& oldEndorseContent = oldEndorseCertificate.content();
+      Ptr<EndorseCertificate> oldEndorseCertificate = NULL;
+      try{
+        Ptr<Data> plainData = Data::decodeFromWire(oldEndorseCertificateBlob);
+        oldEndorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(*plainData));
+      }catch(exception& e){
+        _LOG_ERROR("Exception: " << e.what());
+        return;
+      }
+      const Blob& oldEndorseContent = oldEndorseCertificate->content();
       const Blob& newEndorseContent = newEndorseCertificate->content();
       if(oldEndorseContent == newEndorseContent)
         return;
@@ -327,7 +345,13 @@
 
   vector<string> endorseList = m_contactStorage->getEndorseList(identity);
 
-  Ptr<EndorseCertificate> cert = Ptr<EndorseCertificate>(new EndorseCertificate(contact->getSelfEndorseCertificate(), signerKeyName, endorseList)); 
+  Ptr<EndorseCertificate> cert = NULL;
+  try{
+    cert = Ptr<EndorseCertificate>(new EndorseCertificate(contact->getSelfEndorseCertificate(), signerKeyName, endorseList)); 
+  }catch(exception& e){
+    _LOG_ERROR("Exception: " << e.what());
+    return NULL;
+  } 
   identityManager->signByCertificate(*cert, signerCertName);
 
   return cert;
@@ -384,9 +408,16 @@
   for(; it != profile.end(); it++)
     endorseList.push_back(it->first);
   
-  Ptr<EndorseCertificate> selfEndorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(*kskCert,
-                                                                                                  profileData,
-                                                                                                  endorseList));
+  Ptr<EndorseCertificate> selfEndorseCertificate = NULL;
+  try{
+    selfEndorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(*kskCert,
+                                                                            profileData,
+                                                                            endorseList));
+  }catch(exception& e){
+    _LOG_ERROR("Exception: " << e.what());
+    return NULL;
+  } 
+
   identityManager->signByCertificate(*selfEndorseCertificate, kskCert->getName());
 
   return selfEndorseCertificate;
@@ -398,9 +429,15 @@
 {
   Ptr<Blob> dataContentBlob = Ptr<Blob>(new Blob(data->content().buf(), data->content().size()));
 
-  Ptr<Data> plainData = Data::decodeFromWire(dataContentBlob);
-
-  Ptr<EndorseCertificate> selfEndorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(*plainData));
+  Ptr<Data> plainData = NULL;
+  Ptr<EndorseCertificate> selfEndorseCertificate = NULL;
+  try{
+    plainData = Data::decodeFromWire(dataContentBlob);
+    selfEndorseCertificate = Ptr<EndorseCertificate>(new EndorseCertificate(*plainData));
+  }catch(exception& e){
+    _LOG_ERROR("Exception: " << e.what());
+    return;
+  }
 
   const security::Publickey& ksk = selfEndorseCertificate->getPublicKeyInfo();
 
