diff --git a/src/logic.cpp b/src/logic.cpp
index 9d0f3fa..81d84c8 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -300,7 +300,7 @@
         insertToDiffLog(commit, previousRoot);
 
         satisfyPendingSyncInterests(prefix, commit);
-        formAndSendExcludeInterest(prefix, *commit, previousRoot);
+        // formAndSendExcludeInterest(prefix, *commit, previousRoot);
       }
     }
   }
@@ -382,7 +382,7 @@
     _LOG_DEBUG_ID("Data obtained using exclude filter");
     onSyncDataValidated(data, false);
   }
-  sendExcludeInterest(interest, data);
+  // sendExcludeInterest(interest, data);
 
   _LOG_DEBUG_ID("<< Logic::onSyncData");
 }
@@ -414,9 +414,14 @@
   Name name = data.getName();
   ConstBufferPtr digest = make_shared<ndn::Buffer>(name.get(-1).value(), name.get(-1).value_size());
 
-  auto contentBuffer = bzip2::decompress(reinterpret_cast<const char*>(data.getContent().value()),
-                                         data.getContent().value_size());
-  processSyncData(name, digest, Block(contentBuffer), firstData);
+  try {
+    auto contentBuffer = bzip2::decompress(reinterpret_cast<const char*>(data.getContent().value()),
+                                           data.getContent().value_size());
+    processSyncData(name, digest, Block(contentBuffer), firstData);
+  }
+  catch (const std::ios_base::failure& error) {
+    _LOG_WARN("Error decompressing content of " << data.getName() << " (" << error.what() << ")");
+  }
 }
 
 void
@@ -837,56 +842,56 @@
   _LOG_DEBUG_ID("<< Logic::onRecoveryTimeout");
 }
 
-void
-Logic::sendExcludeInterest(const Interest& interest, const Data& data)
-{
-  _LOG_DEBUG_ID(">> Logic::sendExcludeInterest");
+// void
+// Logic::sendExcludeInterest(const Interest& interest, const Data& data)
+// {
+//   _LOG_DEBUG_ID(">> Logic::sendExcludeInterest");
 
-  Name interestName = interest.getName();
-  Interest excludeInterest(interestName);
+//   Name interestName = interest.getName();
+//   Interest excludeInterest(interestName);
 
-  Exclude exclude = interest.getExclude();
-  exclude.excludeOne(data.getFullName().get(-1));
-  excludeInterest.setExclude(exclude);
-  excludeInterest.setMustBeFresh(true);
+//   Exclude exclude = interest.getExclude();
+//   exclude.excludeOne(data.getFullName().get(-1));
+//   excludeInterest.setExclude(exclude);
+//   excludeInterest.setMustBeFresh(true);
 
-  excludeInterest.setInterestLifetime(m_syncInterestLifetime);
+//   excludeInterest.setInterestLifetime(m_syncInterestLifetime);
 
-  if (excludeInterest.wireEncode().size() > ndn::MAX_NDN_PACKET_SIZE) {
-    return;
-  }
+//   if (excludeInterest.wireEncode().size() > ndn::MAX_NDN_PACKET_SIZE) {
+//     return;
+//   }
 
-  m_face.expressInterest(excludeInterest,
-                         bind(&Logic::onSyncData, this, _1, _2),
-                         bind(&Logic::onSyncTimeout, this, _1), // Nack
-                         bind(&Logic::onSyncTimeout, this, _1));
+//   m_face.expressInterest(excludeInterest,
+//                          bind(&Logic::onSyncData, this, _1, _2),
+//                          bind(&Logic::onSyncTimeout, this, _1), // Nack
+//                          bind(&Logic::onSyncTimeout, this, _1));
 
-  _LOG_DEBUG_ID("Send interest: " << excludeInterest.getName());
-  _LOG_DEBUG_ID("<< Logic::sendExcludeInterest");
-}
+//   _LOG_DEBUG_ID("Send interest: " << excludeInterest.getName());
+//   _LOG_DEBUG_ID("<< Logic::sendExcludeInterest");
+// }
 
-void
-Logic::formAndSendExcludeInterest(const Name& nodePrefix, const State& commit, ConstBufferPtr previousRoot)
-{
-  _LOG_DEBUG_ID(">> Logic::formAndSendExcludeInterest");
-  Name interestName;
-  interestName.append(m_syncPrefix)
-              .append(ndn::name::Component(*previousRoot));
-  Interest interest(interestName);
+// void
+// Logic::formAndSendExcludeInterest(const Name& nodePrefix, const State& commit, ConstBufferPtr previousRoot)
+// {
+//   _LOG_DEBUG_ID(">> Logic::formAndSendExcludeInterest");
+//   Name interestName;
+//   interestName.append(m_syncPrefix)
+//               .append(ndn::name::Component(*previousRoot));
+//   Interest interest(interestName);
 
-  Data data(interestName);
-  data.setContent(commit.wireEncode());
-  data.setFreshnessPeriod(m_syncReplyFreshness);
-  if (m_nodeList.find(nodePrefix) == m_nodeList.end())
-    return;
-  if (m_nodeList[nodePrefix].signingId.empty())
-    m_keyChain.sign(data);
-  else
-    m_keyChain.sign(data, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
+//   Data data(interestName);
+//   data.setContent(commit.wireEncode());
+//   data.setFreshnessPeriod(m_syncReplyFreshness);
+//   if (m_nodeList.find(nodePrefix) == m_nodeList.end())
+//     return;
+//   if (m_nodeList[nodePrefix].signingId.empty())
+//     m_keyChain.sign(data);
+//   else
+//     m_keyChain.sign(data, security::signingByIdentity(m_nodeList[nodePrefix].signingId));
 
-  sendExcludeInterest(interest, data);
+//   sendExcludeInterest(interest, data);
 
-  _LOG_DEBUG_ID("<< Logic::formAndSendExcludeInterest");
-}
+//   _LOG_DEBUG_ID("<< Logic::formAndSendExcludeInterest");
+// }
 
 } // namespace chronosync
diff --git a/src/logic.hpp b/src/logic.hpp
index 1d4fa8e..1aef992 100644
--- a/src/logic.hpp
+++ b/src/logic.hpp
@@ -442,28 +442,28 @@
   void
   onRecoveryTimeout(const Interest& interest);
 
-  /**
-   * @brief Helper method to send Exclude Interest
-   *
-   * @param interest    The interest whose exclude filter will be augmented
-   * @param data        The data whose implicit digest will be inserted into exclude filter
-   */
-  void
-  sendExcludeInterest(const Interest& interest, const Data& data);
+  // /**
+  //  * @brief Helper method to send Exclude Interest
+  //  *
+  //  * @param interest    The interest whose exclude filter will be augmented
+  //  * @param data        The data whose implicit digest will be inserted into exclude filter
+  //  */
+  // void
+  // sendExcludeInterest(const Interest& interest, const Data& data);
 
-  /**
-   * @brief Helper method to form the exclude Interest and calls sendExcludeInterest
-   *
-   * @param interest       The interest whose exclude filter will be augmented
-   * @param nodePrefix     The prefix of the sender node
-   * @param commit         The commit whose contents will be used to obtain the implicit
-                           digest to be excluded
-   * @param previousRoot   The digest to be included in the interest
-   */
-  void
-  formAndSendExcludeInterest(const Name& nodePrefix,
-                             const State& commit,
-                             ConstBufferPtr previousRoot);
+  // /**
+  //  * @brief Helper method to form the exclude Interest and calls sendExcludeInterest
+  //  *
+  //  * @param interest       The interest whose exclude filter will be augmented
+  //  * @param nodePrefix     The prefix of the sender node
+  //  * @param commit         The commit whose contents will be used to obtain the implicit
+  //                          digest to be excluded
+  //  * @param previousRoot   The digest to be included in the interest
+  //  */
+  // void
+  // formAndSendExcludeInterest(const Name& nodePrefix,
+  //                            const State& commit,
+  //                            ConstBufferPtr previousRoot);
 
 public:
   static const ndn::Name DEFAULT_NAME;
