diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index db8a192..204aaaa 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -126,7 +126,7 @@
   }
 
   shared_ptr<Face> face = this->getFace(mi.lastNexthop);
-  if (face == nullptr || !fibEntry.hasNextHop(face)) {
+  if (face == nullptr || !fibEntry.hasNextHop(*face)) {
     NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-gone");
     return false;
   }
@@ -140,7 +140,7 @@
   NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop <<
                 " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
 
-  this->sendInterest(pitEntry, face);
+  this->sendInterest(pitEntry, *face);
 
   // schedule RTO timeout
   shared_ptr<PitInfo> pi = pitEntry->getOrCreateStrategyInfo<PitInfo>();
@@ -171,11 +171,11 @@
                           std::unordered_set<FaceId> exceptFaces)
 {
   for (const fib::NextHop& nexthop : fibEntry.getNextHops()) {
-    shared_ptr<Face> face = nexthop.getFace();
-    if (exceptFaces.count(face->getId()) > 0) {
+    Face& face = nexthop.getFace();
+    if (exceptFaces.count(face.getId()) > 0) {
       continue;
     }
-    NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << face->getId() <<
+    NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << face.getId() <<
                   " multicast");
     this->sendInterest(pitEntry, face);
   }
diff --git a/daemon/fw/asf-probing-module.cpp b/daemon/fw/asf-probing-module.cpp
index f561b52..097a372 100644
--- a/daemon/fw/asf-probing-module.cpp
+++ b/daemon/fw/asf-probing-module.cpp
@@ -64,7 +64,7 @@
   });
 }
 
-shared_ptr<Face>
+Face*
 ProbingModule::getFaceToProbe(const Face& inFace,
                               const Interest& interest,
                               const fib::Entry& fibEntry,
@@ -84,23 +84,23 @@
   // Put eligible faces into rankedFaces. If a face does not have an RTT measurement,
   // immediately pick the face for probing
   for (const fib::NextHop& hop : fibEntry.getNextHops()) {
-    const shared_ptr<Face>& hopFace = hop.getFace();
+    Face& hopFace = hop.getFace();
 
     // Don't send probe Interest back to the incoming face or use the same face
     // as the forwarded Interest
-    if (hopFace->getId() == inFace.getId() || hopFace->getId() == faceUsed.getId()) {
+    if (hopFace.getId() == inFace.getId() || hopFace.getId() == faceUsed.getId()) {
       continue;
     }
 
-    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
+    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, hopFace);
 
     // If no RTT has been recorded, probe this face
     if (info == nullptr || !info->hasSrttMeasurement()) {
-      return hopFace;
+      return &hopFace;
     }
 
     // Add FaceInfo to container sorted by RTT
-    rankedFaces.insert(std::make_pair(info, hopFace));
+    rankedFaces.insert(std::make_pair(info, &hopFace));
   }
 
   if (rankedFaces.empty()) {
@@ -140,7 +140,7 @@
   scheduleProbe(fibEntry, m_probingInterval);
 }
 
-shared_ptr<Face>
+Face*
 ProbingModule::getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces)
 {
   double randomNumber = getRandomNumber(0, 1);
diff --git a/daemon/fw/asf-probing-module.hpp b/daemon/fw/asf-probing-module.hpp
index 585b76a..3a4df6e 100644
--- a/daemon/fw/asf-probing-module.hpp
+++ b/daemon/fw/asf-probing-module.hpp
@@ -43,7 +43,7 @@
   void
   scheduleProbe(const fib::Entry& fibEntry, const time::milliseconds& interval);
 
-  shared_ptr<Face>
+  Face*
   getFaceToProbe(const Face& inFace,
                  const Interest& interest,
                  const fib::Entry& fibEntry,
@@ -57,11 +57,11 @@
 
 private:
   // Used to associate FaceInfo with the face in a NextHop
-  typedef std::pair<FaceInfo*, shared_ptr<Face>> FaceInfoFacePair;
+  typedef std::pair<FaceInfo*, Face*> FaceInfoFacePair;
   typedef std::function<bool(FaceInfoFacePair, FaceInfoFacePair)> FaceInfoPredicate;
   typedef std::set<FaceInfoFacePair, FaceInfoPredicate> FaceInfoFacePairSet;
 
-  shared_ptr<Face>
+  Face*
   getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces);
 
   double
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index cf616e8..3f8abf7 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -79,7 +79,7 @@
     return;
   }
 
-  const shared_ptr<Face> faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
+  Face* faceToUse = getBestFaceForForwarding(fibEntry, interest, inFace);
 
   if (faceToUse == nullptr) {
     sendNoRouteNack(inFace, interest, pitEntry);
@@ -87,18 +87,18 @@
     return;
   }
 
-  forwardInterest(interest, fibEntry, pitEntry, faceToUse);
+  forwardInterest(interest, fibEntry, pitEntry, *faceToUse);
 
   // If necessary, send probe
   if (m_probing.isProbingNeeded(fibEntry, interest)) {
-    shared_ptr<Face> faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
+    Face* faceToProbe = m_probing.getFaceToProbe(inFace, interest, fibEntry, *faceToUse);
 
     if (faceToProbe != nullptr) {
       NFD_LOG_TRACE("Sending probe for " << fibEntry.getPrefix()
                                          << " to FaceId: " << faceToProbe->getId());
 
       bool wantNewNonce = true;
-      forwardInterest(interest, fibEntry, pitEntry, faceToProbe, wantNewNonce);
+      forwardInterest(interest, fibEntry, pitEntry, *faceToProbe, wantNewNonce);
       m_probing.afterForwardingProbe(fibEntry, interest);
     }
   }
@@ -143,27 +143,27 @@
 AsfStrategy::forwardInterest(const Interest& interest,
                              const fib::Entry& fibEntry,
                              shared_ptr<pit::Entry> pitEntry,
-                             shared_ptr<Face> outFace,
+                             Face& outFace,
                              bool wantNewNonce)
 {
   this->sendInterest(pitEntry, outFace, wantNewNonce);
 
-  FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, *outFace);
+  FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interest, outFace);
 
   // Refresh measurements since Face is being used for forwarding
   NamespaceInfo& namespaceInfo = m_measurements.getOrCreateNamespaceInfo(fibEntry, interest);
-  namespaceInfo.extendFaceInfoLifetime(faceInfo, *outFace);
+  namespaceInfo.extendFaceInfoLifetime(faceInfo, outFace);
 
   if (!faceInfo.isTimeoutScheduled()) {
     // Estimate and schedule timeout
     RttEstimator::Duration timeout = faceInfo.computeRto();
 
     NFD_LOG_TRACE("Scheduling timeout for " << fibEntry.getPrefix()
-                                            << " FaceId: " << outFace->getId()
+                                            << " FaceId: " << outFace.getId()
                                             << " in " << time::duration_cast<time::milliseconds>(timeout) << " ms");
 
     scheduler::EventId id = scheduler::schedule(timeout,
-        bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace->getId()));
+        bind(&AsfStrategy::onTimeout, this, interest.getName(), outFace.getId()));
 
     faceInfo.setTimeoutEvent(id, interest.getName());
   }
@@ -171,7 +171,7 @@
 
 struct FaceStats
 {
-  shared_ptr<Face> face;
+  Face* face;
   RttStats::Rtt rtt;
   RttStats::Rtt srtt;
   uint64_t cost;
@@ -196,7 +196,7 @@
   }
 }
 
-const shared_ptr<Face>
+Face*
 AsfStrategy::getBestFaceForForwarding(const fib::Entry& fibEntry, const ndn::Interest& interest, const Face& inFace)
 {
   NFD_LOG_TRACE("Looking for best face for " << fibEntry.getPrefix());
@@ -222,17 +222,16 @@
   });
 
   for (const fib::NextHop& hop : fibEntry.getNextHops()) {
+    Face& hopFace = hop.getFace();
 
-    const shared_ptr<Face>& hopFace = hop.getFace();
-
-    if (hopFace->getId() == inFace.getId()) {
+    if (hopFace.getId() == inFace.getId()) {
       continue;
     }
 
-    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
+    FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, hopFace);
 
     if (info == nullptr) {
-      FaceStats stats = {hopFace,
+      FaceStats stats = {&hopFace,
                          RttStats::RTT_NO_MEASUREMENT,
                          RttStats::RTT_NO_MEASUREMENT,
                          hop.getCost()};
@@ -240,7 +239,7 @@
       rankedFaces.insert(stats);
     }
     else {
-      FaceStats stats = {hopFace, info->getRtt(), info->getSrtt(), hop.getCost()};
+      FaceStats stats = {&hopFace, info->getRtt(), info->getSrtt(), hop.getCost()};
       rankedFaces.insert(stats);
     }
   }
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index cb50e01..ad00a3d 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -69,10 +69,10 @@
   forwardInterest(const Interest& interest,
                   const fib::Entry& fibEntry,
                   shared_ptr<pit::Entry> pitEntry,
-                  shared_ptr<Face> outFace,
+                  Face& outFace,
                   bool wantNewNonce = false);
 
-  const shared_ptr<Face>
+  Face*
   getBestFaceForForwarding(const fib::Entry& fibEntry, const ndn::Interest& interest, const Face& inFace);
 
   void
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
index bae5262..b97afca 100644
--- a/daemon/fw/best-route-strategy.cpp
+++ b/daemon/fw/best-route-strategy.cpp
@@ -54,14 +54,14 @@
   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
   fib::NextHopList::const_iterator it = std::find_if(nexthops.begin(), nexthops.end(),
-    [&pitEntry] (const fib::NextHop& nexthop) { return canForwardToLegacy(*pitEntry, *nexthop.getFace()); });
+    [&pitEntry] (const fib::NextHop& nexthop) { return canForwardToLegacy(*pitEntry, nexthop.getFace()); });
 
   if (it == nexthops.end()) {
     this->rejectPendingInterest(pitEntry);
     return;
   }
 
-  shared_ptr<Face> outFace = it->getFace();
+  Face& outFace = it->getFace();
   this->sendInterest(pitEntry, outFace);
 }
 
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index ef68175..df6ca4d 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -59,19 +59,19 @@
   bool wantUnused = false,
   time::steady_clock::TimePoint now = time::steady_clock::TimePoint::min())
 {
-  shared_ptr<Face> upstream = nexthop.getFace();
+  Face& upstream = nexthop.getFace();
 
   // upstream is current downstream
-  if (upstream->getId() == currentDownstream)
+  if (upstream.getId() == currentDownstream)
     return false;
 
   // forwarding would violate scope
-  if (violatesScope(*pitEntry, *upstream))
+  if (violatesScope(*pitEntry, upstream))
     return false;
 
   if (wantUnused) {
     // NextHop must not have unexpired out-record
-    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(*upstream);
+    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(upstream);
     if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
       return false;
     }
@@ -93,7 +93,7 @@
   for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
     if (!predicate_NextHop_eligible(pitEntry, *it, currentDownstream))
       continue;
-    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(*it->getFace());
+    pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(it->getFace());
     BOOST_ASSERT(outRecord != pitEntry->out_end());
     if (outRecord->getLastRenewed() < earliestRenewed) {
       found = it;
@@ -136,10 +136,10 @@
       return;
     }
 
-    shared_ptr<Face> outFace = it->getFace();
+    Face& outFace = it->getFace();
     this->sendInterest(pitEntry, outFace);
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " newPitEntry-to=" << outFace->getId());
+                           << " newPitEntry-to=" << outFace.getId());
     return;
   }
 
@@ -148,10 +148,10 @@
                     bind(&predicate_NextHop_eligible, pitEntry, _1, inFace.getId(),
                          true, time::steady_clock::now()));
   if (it != nexthops.end()) {
-    shared_ptr<Face> outFace = it->getFace();
+    Face& outFace = it->getFace();
     this->sendInterest(pitEntry, outFace);
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " retransmit-unused-to=" << outFace->getId());
+                           << " retransmit-unused-to=" << outFace.getId());
     return;
   }
 
@@ -161,10 +161,10 @@
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " retransmitNoNextHop");
   }
   else {
-    shared_ptr<Face> outFace = it->getFace();
+    Face& outFace = it->getFace();
     this->sendInterest(pitEntry, outFace);
     NFD_LOG_DEBUG(interest << " from=" << inFace.getId()
-                           << " retransmit-retry-to=" << outFace->getId());
+                           << " retransmit-retry-to=" << outFace.getId());
   }
 }
 
diff --git a/daemon/fw/best-route-strategy2.hpp b/daemon/fw/best-route-strategy2.hpp
index 8c6a778..d78baf6 100644
--- a/daemon/fw/best-route-strategy2.hpp
+++ b/daemon/fw/best-route-strategy2.hpp
@@ -56,10 +56,12 @@
 
   virtual void
   afterReceiveInterest(const Face& inFace, const Interest& interest,
+
                        shared_ptr<pit::Entry> pitEntry) override;
 
   virtual void
   afterReceiveNack(const Face& inFace, const lp::Nack& nack,
+
                    shared_ptr<pit::Entry> pitEntry) override;
 
 public:
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index 044e065..a73291b 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -66,7 +66,7 @@
     return;
   }
 
-  this->sendInterest(pitEntry, outFace);
+  this->sendInterest(pitEntry, *outFace);
 }
 
 } // namespace fw
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index b4bda23..4cda948 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -108,7 +108,7 @@
                " remote=" << face->getRemoteUri() <<
                " local=" << face->getLocalUri());
 
-  m_forwarder.getFib().removeNextHopFromAllEntries(face);
+  m_forwarder.getFib().removeNextHopFromAllEntries(*face);
 
   // defer Face deallocation, so that Transport isn't deallocated during afterStateChange signal
   getGlobalIoService().post([face] {});
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3bb580d..0b4c653 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -522,7 +522,7 @@
   // has Link object?
   if (!interest.hasLink()) {
     // FIB lookup with Interest name
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(pitEntry);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(pitEntry);
     NFD_LOG_TRACE("lookupFib noLinkObject found=" << fibEntry.getPrefix());
     return fibEntry;
   }
@@ -532,7 +532,7 @@
   // in producer region?
   if (m_networkRegionTable.isInProducerRegion(link)) {
     // FIB lookup with Interest name
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(pitEntry);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(pitEntry);
     NFD_LOG_TRACE("lookupFib inProducerRegion found=" << fibEntry.getPrefix());
     return fibEntry;
   }
@@ -541,13 +541,13 @@
   if (interest.hasSelectedDelegation()) {
     // FIB lookup with SelectedDelegation
     Name selectedDelegation = interest.getSelectedDelegation();
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(selectedDelegation);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(selectedDelegation);
     NFD_LOG_TRACE("lookupFib hasSelectedDelegation=" << selectedDelegation << " found=" << fibEntry.getPrefix());
     return fibEntry;
   }
 
   // FIB lookup with first delegation Name
-  const fib::Entry& fibEntry0 = *m_fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
+  const fib::Entry& fibEntry0 = m_fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
   // in default-free zone?
   bool isDefaultFreeZone = !(fibEntry0.getPrefix().size() == 0 && fibEntry0.hasNextHops());
   if (!isDefaultFreeZone) {
@@ -558,7 +558,7 @@
   // choose and set SelectedDelegation
   for (const std::pair<uint32_t, Name>& delegation : link.getDelegations()) {
     const Name& delegationName = delegation.second;
-    const fib::Entry& fibEntry = *m_fib.findLongestPrefixMatch(delegationName);
+    const fib::Entry& fibEntry = m_fib.findLongestPrefixMatch(delegationName);
     if (fibEntry.hasNextHops()) {
       /// \todo Don't modify in-record Interests.
       ///       Set SelectedDelegation in outgoing Interest pipeline.
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 9b89049..5373d03 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -46,8 +46,8 @@
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
 
   for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
-    shared_ptr<Face> outFace = it->getFace();
-    if (canForwardToLegacy(*pitEntry, *outFace)) {
+    Face& outFace = it->getFace();
+    if (canForwardToLegacy(*pitEntry, outFace)) {
       this->sendInterest(pitEntry, outFace);
     }
   }
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index a459552..fc9cd20 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -74,13 +74,13 @@
   size_t nUpstreams = nexthops.size();
 
   shared_ptr<Face> bestFace = measurementsEntryInfo->getBestFace();
-  if (bestFace != nullptr && fibEntry.hasNextHop(bestFace) &&
+  if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace) &&
       canForwardToLegacy(*pitEntry, *bestFace)) {
     // TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
     deferFirst = measurementsEntryInfo->prediction;
     deferRange = time::microseconds((deferFirst.count() + 1) / 2);
     --nUpstreams;
-    this->sendInterest(pitEntry, bestFace);
+    this->sendInterest(pitEntry, *bestFace);
     pitEntryInfo->bestFaceTimeout = scheduler::schedule(
       measurementsEntryInfo->prediction,
       bind(&NccStrategy::timeoutOnBestFace, this, weak_ptr<pit::Entry>(pitEntry)));
@@ -89,7 +89,7 @@
     // use first eligible nexthop
     auto firstEligibleNexthop = std::find_if(nexthops.begin(), nexthops.end(),
         [&pitEntry] (const fib::NextHop& nexthop) {
-          return canForwardToLegacy(*pitEntry, *nexthop.getFace());
+          return canForwardToLegacy(*pitEntry, nexthop.getFace());
         });
     if (firstEligibleNexthop != nexthops.end()) {
       this->sendInterest(pitEntry, firstEligibleNexthop->getFace());
@@ -97,7 +97,7 @@
   }
 
   shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
-  if (previousFace != nullptr && fibEntry.hasNextHop(previousFace) &&
+  if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
     --nUpstreams;
   }
@@ -135,16 +135,16 @@
     this->getMeasurementsEntryInfo(pitEntry);
 
   shared_ptr<Face> previousFace = measurementsEntryInfo->previousFace.lock();
-  if (previousFace != nullptr && fibEntry.hasNextHop(previousFace) &&
+  if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
       canForwardToLegacy(*pitEntry, *previousFace)) {
-    this->sendInterest(pitEntry, previousFace);
+    this->sendInterest(pitEntry, *previousFace);
   }
 
   const fib::NextHopList& nexthops = fibEntry.getNextHops();
   bool isForwarded = false;
   for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
-    shared_ptr<Face> face = it->getFace();
-    if (canForwardToLegacy(*pitEntry, *face)) {
+    Face& face = it->getFace();
+    if (canForwardToLegacy(*pitEntry, face)) {
       isForwarded = true;
       this->sendInterest(pitEntry, face);
       break;
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 3a11568..386dd7f 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -130,7 +130,7 @@
    *                      rather than reusing a Nonce from one of the PIT in-records
    */
   VIRTUAL_WITH_TESTS void
-  sendInterest(shared_ptr<pit::Entry> pitEntry, shared_ptr<Face> outFace,
+  sendInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace,
                bool wantNewNonce = false);
 
   /** \brief decide that a pending Interest cannot be forwarded
@@ -200,11 +200,9 @@
 }
 
 inline void
-Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry,
-                       shared_ptr<Face> outFace,
-                       bool wantNewNonce)
+Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace, bool wantNewNonce)
 {
-  m_forwarder.onOutgoingInterest(pitEntry, *outFace, wantNewNonce);
+  m_forwarder.onOutgoingInterest(pitEntry, outFace, wantNewNonce);
 }
 
 inline void
