diff --git a/src/sequential-data-fetcher.cpp b/src/sequential-data-fetcher.cpp
index 5873374..06b3f02 100644
--- a/src/sequential-data-fetcher.cpp
+++ b/src/sequential-data-fetcher.cpp
@@ -66,8 +66,10 @@
 {
   std::vector<ndn::Name> returnedNames;
   returnedNames = m_manager->downloadTorrentFile(".appdata/torrent_files/");
-  std::cout << "Torrent File Received: "
-            << m_torrentFileName.getSubName(0, m_torrentFileName.size() - 1) << std::endl;
+  if (!returnedNames.empty() && IoUtil::NAME_TYPE::FILE_MANIFEST == IoUtil::findType(returnedNames[0])) {
+    std::cout << "Torrent File Received: "
+              << m_torrentFileName.getSubName(0, m_torrentFileName.size() - 1) << std::endl;
+  }
   return returnedNames;
 }
 
@@ -91,8 +93,8 @@
     m_manager->download_data_packet(*i,
                               bind(&SequentialDataFetcher::onDataPacketReceived, this, _1),
                               bind(&SequentialDataFetcher::onDataRetrievalFailure, this, _1, _2));
-    m_manager->processEvents();
   }
+  m_manager->processEvents();
 }
 
 void
@@ -134,26 +136,26 @@
 SequentialDataFetcher::onDataRetrievalFailure(const ndn::Interest& interest,
                                               const std::string& errorCode)
 {
-  std::cerr << "Data Retrieval Failed: " << interest.getName() << std::endl;
+  // std::cerr << "Data Retrieval Failed: " << interest.getName() << std::endl;
 
   // Data retrieval failure
   uint32_t nameType = IoUtil::findType(interest.getName());
   if (nameType == IoUtil::TORRENT_FILE) {
     // this should never happen
-    std::cerr << "Torrent File Segment Downloading Failed: " << interest.getName();
+    // std::cerr << "Torrent File Segment Downloading Failed: " << interest.getName();
     this->downloadTorrentFile();
   }
   else if (nameType == IoUtil::FILE_MANIFEST) {
-    std::cerr << "Manifest File Segment Downloading Failed: " << interest.getName();
+    // std::cerr << "Manifest File Segment Downloading Failed: " << interest.getName();
     this->downloadManifestFiles({ interest.getName() });
   }
   else if (nameType == IoUtil::DATA_PACKET) {
-    std::cerr << "Data Packet Downloading Failed: " << interest.getName();
+    // std::cerr << "Data Packet Downloading Failed: " << interest.getName();
     this->downloadPackets({ interest.getName() });
   }
   else {
     // This should never happen
-    std::cerr << "Unknown Packet Type Downloading Failed: " << interest.getName();
+    // std::cerr << "Unknown Packet Type Downloading Failed: " << interest.getName();
   }
 }
 
diff --git a/src/torrent-manager.cpp b/src/torrent-manager.cpp
index 75e09b5..790e166 100644
--- a/src/torrent-manager.cpp
+++ b/src/torrent-manager.cpp
@@ -174,8 +174,8 @@
     torrentName = m_torrentFileName.getSubName(1, m_torrentFileName.size() - 3);
   }
 
-  m_updateHandler = make_shared<UpdateHandler>(torrentName, m_keyChain,
-                                               make_shared<StatsTable>(m_statsTable), m_face);
+  // m_updateHandler = make_shared<UpdateHandler>(torrentName, m_keyChain,
+  //                                              make_shared<StatsTable>(m_statsTable), m_face);
 
   // .../<torrent_name>/torrent-file/<implicit_digest>
   string dataPath = ".appdata/" + m_torrentFileName.get(-3).toUri();
@@ -246,9 +246,9 @@
 TorrentManager::downloadTorrentFile(const std::string& path)
 {
   // check whether we should send out an "ALIVE" Interest
-  if (m_updateHandler->needsUpdate()) {
-    m_updateHandler->sendAliveInterest(m_stats_table_iter);
-  }
+  // if (m_updateHandler->needsUpdate()) {
+  //   m_updateHandler->sendAliveInterest(m_stats_table_iter);
+  // }
   shared_ptr<Name> searchRes = this->findTorrentFileSegmentToDownload();
   auto manifestNames = make_shared<std::vector<Name>>();
   if (searchRes == nullptr) {
@@ -564,7 +564,6 @@
   const auto& interestName = interest.getName();
   std::shared_ptr<Data> data = nullptr;
   auto cmp = [&interestName](const Data& t){return t.getFullName() == interestName;};
-
   // determine if it is torrent file (that we have)
   auto torrent_it =  std::find_if(m_torrentSegments.begin(), m_torrentSegments.end(), cmp);
   if (m_torrentSegments.end() != torrent_it) {
@@ -698,12 +697,14 @@
 
   // find the pair of (std::shared_ptr<fs::fstream>, std::vector<bool>)
   // that corresponds to the specific submanifest
-  auto& fileState = m_fileStates[manifest_it->getFullName()];
-
-  auto dataNum = dataName.get(dataName.size() - 2).toSequenceNumber();
-
-  // find whether we have the requested packet from the bitmap
-  return fileState.second[dataNum];
+  auto fileState_it = m_fileStates.find(manifest_it->getFullName());
+  if (m_fileStates.end() != fileState_it) {
+    const auto& fileState = fileState_it->second;
+    auto dataNum = dataName.get(dataName.size() - 2).toSequenceNumber();
+    // find whether we have the requested packet from the bitmap
+    return fileState.second[dataNum];
+  }
+  return false;
 }
 
 void
@@ -733,12 +734,21 @@
 void
 TorrentManager::findAllMissingDataPackets(std::vector<Name>& packetNames)
 {
-  for (auto j = m_fileManifests.begin(); j != m_fileManifests.end(); j++) {
-    auto& fileState = m_fileStates[j->getFullName()];
-    for (auto i = j->catalog().begin(); i != j->catalog().end(); i++) {
-      auto dataNum = i->get(i->size() - 2).toSequenceNumber();
-      if (!fileState.second[dataNum]) {
-        packetNames.push_back(*i);
+  for (auto j = m_fileManifests.begin(); j != m_fileManifests.end(); ++j) {
+    auto fileState_it = m_fileStates.find(j->getFullName());
+    // if we have no packets from this file
+    if (m_fileStates.end() == fileState_it) {
+      packetNames.reserve(packetNames.size() + j->catalog().size());
+      packetNames.insert(packetNames.end(), j->catalog().begin(), j->catalog().end());
+    }
+    // find the packets that we are missing
+    else {
+      const auto &fileState =  fileState_it->second;
+      for (auto i = j->catalog().begin(); i != j->catalog().end(); i++) {
+        auto dataNum = i->get(i->size() - 2).toSequenceNumber();
+        if (!fileState.second[dataNum]) {
+          packetNames.push_back(*i);
+        }
       }
     }
   }
@@ -763,9 +773,9 @@
   if (m_sortingCounter >= SORTING_INTERVAL) {
     // Use the sorting interval to send out "ALIVE" Interests as well
     // check whether we should send out an "ALIVE" Interest
-    if (m_updateHandler->needsUpdate()) {
-      m_updateHandler->sendAliveInterest(m_stats_table_iter);
-    }
+    // if (m_updateHandler->needsUpdate()) {
+    //   m_updateHandler->sendAliveInterest(m_stats_table_iter);
+    // }
     // Do the actual sorting related stuff
     m_sortingCounter = 0;
     m_statsTable.sort();
