diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 234f059..596ad94 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -216,16 +216,26 @@
 void
 SyncLogic::processSyncInterest (const std::string &name, DigestConstPtr digest, bool timedProcessing/*=false*/)
 {
-  recursive_mutex::scoped_lock lock (m_stateMutex);
+  DigestConstPtr rootDigest;
+  {
+    recursive_mutex::scoped_lock lock (m_stateMutex);
+    rootDigest = m_state->getDigest();
+  }
 
   // Special case when state is not empty and we have received request with zero-root digest
-  if (digest->isZero () && !m_state->getDigest()->isZero ())
+  if (digest->isZero () && !rootDigest->isZero ())
     {
-      sendSyncData (name, digest, m_state);
+      
+      SyncStateMsg ssm;
+      {
+        recursive_mutex::scoped_lock lock (m_stateMutex);
+        ssm << (*m_state);
+      }
+      sendSyncData (name, digest, ssm);
       return;
     }
 
-  if (*m_state->getDigest() == *digest)
+  if (*rootDigest == *digest)
     {
       _LOG_TRACE ("processSyncInterest (): Same state. Adding to PIT");
       m_syncInterestTable.insert (digest, name, false);
@@ -275,7 +285,6 @@
   
   try
     {
-      recursive_mutex::scoped_lock lock (m_stateMutex);
 
       m_syncInterestTable.remove (name); // Remove satisfied interest from PIT
 
@@ -304,7 +313,10 @@
               bool inserted = false;
               bool updated = false;
               SeqNo oldSeq;
-              tie (inserted, updated, oldSeq) = m_state->update (info, seq);
+              {
+                recursive_mutex::scoped_lock lock (m_stateMutex);
+                tie (inserted, updated, oldSeq) = m_state->update (info, seq);
+              }
 
               if (inserted || updated)
                 {
@@ -328,6 +340,7 @@
             }
           else if (diffLeaf->getOperation() == REMOVE)
             {
+              recursive_mutex::scoped_lock lock (m_stateMutex);
               if (m_state->remove (info))
                 {
                   diffLog->remove (info);
@@ -373,7 +386,6 @@
 void
 SyncLogic::processSyncRecoveryInterest (const std::string &name, DigestConstPtr digest)
 {
-  recursive_mutex::scoped_lock lock (m_stateMutex);
   
   DiffStateContainer::iterator stateInDiffLog = m_log.find (digest);
 
@@ -383,7 +395,12 @@
       return;
     }
 
-  sendSyncData (name, digest, m_state);
+  SyncStateMsg ssm;
+  {
+    recursive_mutex::scoped_lock lock (m_stateMutex);
+    ssm << (*m_state);
+  }
+  sendSyncData (name, digest, ssm);
 }
 
 void
@@ -543,10 +560,17 @@
 void
 SyncLogic::sendSyncData (const std::string &name, DigestConstPtr digest, StateConstPtr state)
 {
+  SyncStateMsg msg;
+  msg << (*state);
+  sendSyncData(name, digest, msg);
+}
+
+// pass in state msg instead of state, so that there is no need to lock the state until
+// this function returns
+void
+SyncLogic::sendSyncData (const std::string &name, DigestConstPtr digest, SyncStateMsg &ssm)
+{
   _LOG_TRACE (">> D " << name);
-  // sending
-  SyncStateMsg ssm;
-  ssm << (*state);
   int size = ssm.ByteSize();
   char *wireData = new char[size];
   ssm.SerializeToArray(wireData, size);
