diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index ee56cf7..9e5f285 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -94,19 +94,19 @@
   checkNextHop(const Name& prefix, ssize_t expectedNNextHops = -1,
                FaceId faceId = face::FACEID_NULL, int32_t expectedCost = -1)
   {
-    auto entry = m_fib.findExactMatch(prefix);
-    if (!static_cast<bool>(entry)) {
+    const fib::Entry* entry = m_fib.findExactMatch(prefix);
+    if (entry == nullptr) {
       return CheckNextHopResult::NO_FIB_ENTRY;
     }
 
-    auto nextHops = entry->getNextHops();
+    const fib::NextHopList& nextHops = entry->getNextHops();
     if (expectedNNextHops != -1 && nextHops.size() != static_cast<size_t>(expectedNNextHops)) {
       return CheckNextHopResult::WRONG_N_NEXTHOPS;
     }
 
     if (faceId != face::FACEID_NULL) {
       for (auto&& record : nextHops) {
-        if (record.getFace()->getId() == faceId) {
+        if (record.getFace().getId() == faceId) {
           return expectedCost != -1 && record.getCost() != static_cast<uint32_t>(expectedCost) ?
             CheckNextHopResult::WRONG_COST : CheckNextHopResult::OK;
         }
@@ -285,10 +285,10 @@
   BOOST_REQUIRE_NE(face2, face::INVALID_FACEID);
   BOOST_REQUIRE_NE(face3, face::INVALID_FACEID);
 
-  shared_ptr<fib::Entry> entry = m_fib.insert("/hello").first;
-  entry->addNextHop(m_faceTable.get(face1), 101);
-  entry->addNextHop(m_faceTable.get(face2), 202);
-  entry->addNextHop(m_faceTable.get(face3), 303);
+  fib::Entry* entry = m_fib.insert("/hello").first;
+  entry->addNextHop(*m_faceTable.get(face1), 101);
+  entry->addNextHop(*m_faceTable.get(face2), 202);
+  entry->addNextHop(*m_faceTable.get(face3), 303);
 
   testRemoveNextHop(makeParameters("/hello", face1));
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
@@ -340,9 +340,9 @@
     receiveInterest(command);
   };
 
-  shared_ptr<fib::Entry> entry = m_fib.insert("/hello").first;
-  entry->addNextHop(m_faceTable.get(face1), 101);
-  entry->addNextHop(m_faceTable.get(face2), 202);
+  fib::Entry* entry = m_fib.insert("/hello").first;
+  entry->addNextHop(*m_faceTable.get(face1), 101);
+  entry->addNextHop(*m_faceTable.get(face2), 202);
 
   testWithImplicitFaceId(ControlParameters().setName("/hello").setFaceId(0), face1);
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
@@ -372,7 +372,7 @@
     receiveInterest(command);
   };
 
-  m_fib.insert("/hello").first->addNextHop(m_faceTable.get(face1), 101);
+  m_fib.insert("/hello").first->addNextHop(*m_faceTable.get(face1), 101);
 
   testRemoveNextHop(makeParameters("/hello", face2 + 100));
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1); // face does not exist
@@ -446,9 +446,9 @@
   for (size_t i = 0 ; i < nEntries ; i ++) {
     Name prefix = Name("test").appendSegment(i);
     actualPrefixes.insert(prefix);
-    auto fibEntry = m_fib.insert(prefix).first;
-    fibEntry->addNextHop(m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 1);
-    fibEntry->addNextHop(m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 2);
+    fib::Entry* fibEntry = m_fib.insert(prefix).first;
+    fibEntry->addNextHop(*m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 1);
+    fibEntry->addNextHop(*m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 2);
   }
 
   receiveInterest(makeInterest("/localhost/nfd/fib/list"));
@@ -476,7 +476,7 @@
     const auto& nextHops = matchedEntry->getNextHops();
     for (auto&& next : nextHops) {
       ndn::nfd::NextHopRecord nextHopRecord;
-      nextHopRecord.setFaceId(next.getFace()->getId());
+      nextHopRecord.setFaceId(next.getFace().getId());
       nextHopRecord.setCost(next.getCost());
       record.addNextHopRecord(nextHopRecord);
     }
