add test for dispatcher;
synccore is not working in dispatcher;
additionally, localStateChanged not called somehow;
ccnx ccnLoop throws exception;
diff --git a/src/dispatcher.cc b/src/dispatcher.cc
index babae92..8c93d96 100644
--- a/src/dispatcher.cc
+++ b/src/dispatcher.cc
@@ -38,7 +38,9 @@
                        , const std::string &sharedFolder
                        , const filesystem::path &rootDir
                        , Ccnx::CcnxWrapperPtr ccnx
-                       , int poolSize)
+                       , int poolSize
+                       , bool enablePrefixDiscovery
+                       )
            : m_ccnx(ccnx)
            , m_core(NULL)
            , m_rootDir(rootDir)
@@ -47,6 +49,7 @@
            , m_localUserName(localUserName)
            , m_sharedFolder(sharedFolder)
            , m_server(NULL)
+           , m_enablePrefixDiscovery(enablePrefixDiscovery)
 {
   m_syncLog = make_shared<SyncLog>(m_rootDir, localUserName);
   m_actionLog = make_shared<ActionLog>(m_ccnx, m_rootDir, m_syncLog, sharedFolder,
@@ -65,12 +68,18 @@
   m_actionFetcher = make_shared<FetchManager> (m_ccnx, bind (&SyncLog::LookupLocator, &*m_syncLog, _1), 3);
   m_fileFetcher   = make_shared<FetchManager> (m_ccnx, bind (&SyncLog::LookupLocator, &*m_syncLog, _1), 3);
 
-  Ccnx::CcnxDiscovery::registerCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), "dispatcher"));
+  if (m_enablePrefixDiscovery)
+  {
+    Ccnx::CcnxDiscovery::registerCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), "dispatcher"));
+  }
 }
 
 Dispatcher::~Dispatcher()
 {
-  Ccnx::CcnxDiscovery::deregisterCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), "dispatcher"));
+  if (m_enablePrefixDiscovery)
+  {
+    Ccnx::CcnxDiscovery::deregisterCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), "dispatcher"));
+  }
 
   if (m_core != NULL)
   {
@@ -109,6 +118,7 @@
 void
 Dispatcher::Did_LocalFile_AddOrModify_Execute (filesystem::path relativeFilePath)
 {
+  _LOG_DEBUG(m_localUserName << " calls LocalFile_AddOrModify_Execute");
   filesystem::path absolutePath = m_rootDir / relativeFilePath;
   if (!filesystem::exists(absolutePath))
     {
diff --git a/src/dispatcher.h b/src/dispatcher.h
index c2309b6..1bea184 100644
--- a/src/dispatcher.h
+++ b/src/dispatcher.h
@@ -50,7 +50,9 @@
              , const std::string &sharedFolder
              , const boost::filesystem::path &rootDir
              , Ccnx::CcnxWrapperPtr ccnx
-             , int poolSize = 2);
+             , int poolSize = 2
+             , bool enablePrefixDiscovery = true
+             );
   ~Dispatcher();
 
   // ----- Callbacks, they only submit the job to executor and immediately return so that event processing thread won't be blocked for too long -------
@@ -63,6 +65,10 @@
   void
   Did_LocalFile_Delete (const boost::filesystem::path &relativeFilepath);
 
+  // for test
+  HashPtr
+  SyncRoot() { return m_core->root(); }
+
 private:
   void
   Did_LocalFile_AddOrModify_Execute (boost::filesystem::path relativeFilepath); // cannot be const & for Execute event!!! otherwise there will be segfault
@@ -156,6 +162,7 @@
 
   std::string m_sharedFolder;
   ContentServer *m_server;
+  bool m_enablePrefixDiscovery;
 
   FetchManagerPtr m_actionFetcher;
   FetchManagerPtr m_fileFetcher;
diff --git a/src/sync-core.cc b/src/sync-core.cc
index a4ddfc6..80daac8 100644
--- a/src/sync-core.cc
+++ b/src/sync-core.cc
@@ -86,6 +86,7 @@
   BytesPtr syncData = serializeMsg (*msg);
 
   m_ccnx->publishData(syncName, *syncData, FRESHNESS);
+  _LOG_DEBUG (m_log->GetLocalName () << " localStateChanged ");
   _LOG_TRACE (m_log->GetLocalName () << " publishes: " << *oldHash);
   _LOG_TRACE (msg);