diff --git a/model/sync-digest.cc b/model/sync-digest.cc
index 705a467..6da6e78 100644
--- a/model/sync-digest.cc
+++ b/model/sync-digest.cc
@@ -166,12 +166,16 @@
   if (m_buffer == 0)
     BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
                            << errmsg_info_str ("Digest has not been yet finalized"));
-  // finalize ();
 
+  if (m_hashLength == 1 && m_buffer[0] == 0)
+    return 0;
+  
   if (sizeof (std::size_t) > m_hashLength)
-    BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
-                           << errmsg_info_str ("Hash length is less than size_t")
-                           << errmsg_info_int (m_hashLength));
+    {
+      BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
+                             << errmsg_info_str ("Hash is not zero and length is less than size_t")
+                             << errmsg_info_int (m_hashLength));
+    }
   
   // just getting first sizeof(std::size_t) bytes
   // not ideal, but should work pretty well
@@ -190,10 +194,13 @@
                            << errmsg_info_str ("Digest2 is empty"));
 
   if (m_hashLength != digest.m_hashLength)
-    BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
-                           << errmsg_info_str ("Digest lengths are not the same")
-                           << errmsg_info_int (m_hashLength)
-                           << errmsg_info_int (digest.m_hashLength));
+    return false;
+
+  // Allow different hash size
+  // BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
+  //                        << errmsg_info_str ("Digest lengths are not the same")
+  //                        << errmsg_info_int (m_hashLength)
+  //                        << errmsg_info_int (digest.m_hashLength));
 
   return memcmp (m_buffer, digest.m_buffer, m_hashLength) == 0;
 }
diff --git a/model/sync-full-state.cc b/model/sync-full-state.cc
index d01460e..baac098 100644
--- a/model/sync-full-state.cc
+++ b/model/sync-full-state.cc
@@ -72,7 +72,6 @@
               FullLeafConstPtr fullLeaf = dynamic_pointer_cast<const FullLeaf> (leaf);
               BOOST_ASSERT (fullLeaf != 0);
               *m_digest << fullLeaf->getDigest ();
-              // std::cout << *leaf << "[" << fullLeaf->getDigest () << "] ";
             }
           m_digest->finalize ();
         }
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index cd74f2b..0f71b95 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -118,7 +118,7 @@
 void
 SyncLogic::processSyncData (const string &name, const string &dataBuffer)
 {
-	//cout << "Process Sync Data" <<endl;
+  //cout << "Process Sync Data" <<endl;
   DiffStatePtr diffLog = make_shared<DiffState> ();
   
   try
@@ -211,41 +211,41 @@
 void
 SyncLogic::processPendingSyncInterests (DiffStatePtr &diffLog) 
 {
-	//cout << "Process Pending Interests" <<endl;
+  //cout << "Process Pending Interests" <<endl;
   recursive_mutex::scoped_lock lock (m_stateMutex);
 
-  diffLog->setDigest(m_state.getDigest());
-  if (m_log.size () > 0)
+  diffLog->setDigest (m_state.getDigest());  
+  if (m_log.get<sequenced> ().size () > 0)
     {
       m_log.get<sequenced> ().front ()->setNext (diffLog);
     }
-  m_log.insert (diffLog);
+  m_log.get<sequenced> ().push_back (diffLog);
 
   vector<string> pis = m_syncInterestTable.fetchAll ();
   if (pis.size () > 0)
     {
-  stringstream ss;
+      stringstream ss;
       ss << *diffLog;
-  for (vector<string>::iterator ii = pis.begin(); ii != pis.end(); ++ii)
-  {
-    m_ccnxHandle->publishData (*ii, ss.str(), m_syncResponseFreshness);
-  }
-}
+      for (vector<string>::iterator ii = pis.begin(); ii != pis.end(); ++ii)
+        {
+          m_ccnxHandle->publishData (*ii, ss.str(), m_syncResponseFreshness);
+        }
+    }
 }
 
 void
 SyncLogic::addLocalNames (const string &prefix, uint32_t session, uint32_t seq)
 {
-	//cout << "Add local names" <<endl;
+  //cout << "Add local names" <<endl;
   recursive_mutex::scoped_lock lock (m_stateMutex);
   NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
-  SeqNo seqN(session, seq);
+  
+  SeqNo seqN (session, seq);
   m_state.update(info, seqN);
 
   DiffStatePtr diff = make_shared<DiffState>();
   diff->update(info, seqN);
-
-  processPendingSyncInterests(diff);
+  processPendingSyncInterests (diff);
 }
 
 void
@@ -258,7 +258,7 @@
   DiffStatePtr diff = make_shared<DiffState>();
   diff->remove(info);
 
-  processPendingSyncInterests(diff);
+  processPendingSyncInterests (diff);
 }
 
 void
