diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index a5d692f..a4d864b 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -84,7 +84,7 @@
 bool
 hasPendingOutRecords(const pit::Entry& pitEntry)
 {
-  time::steady_clock::TimePoint now = time::steady_clock::now();
+  auto now = time::steady_clock::now();
   return std::any_of(pitEntry.out_begin(), pitEntry.out_end(),
                       [&now] (const pit::OutRecord& outRecord) {
                         return outRecord.getExpiry() >= now &&
@@ -92,7 +92,7 @@
                       });
 }
 
-time::steady_clock::TimePoint
+time::steady_clock::time_point
 getLastOutgoing(const pit::Entry& pitEntry)
 {
   pit::OutRecordCollection::const_iterator lastOutgoing = std::max_element(
@@ -111,7 +111,7 @@
                                          const shared_ptr<pit::Entry>& pitEntry)
 {
   auto found = nexthops.end();
-  auto earliestRenewed = time::steady_clock::TimePoint::max();
+  auto earliestRenewed = time::steady_clock::time_point::max();
 
   for (auto it = nexthops.begin(); it != nexthops.end(); ++it) {
     if (!isNextHopEligible(inFace, interest, *it, pitEntry))
@@ -132,7 +132,7 @@
                   const fib::NextHop& nexthop,
                   const shared_ptr<pit::Entry>& pitEntry,
                   bool wantUnused,
-                  time::steady_clock::TimePoint now)
+                  time::steady_clock::time_point now)
 {
   const Face& outFace = nexthop.getFace();
 
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3683734..d984f0c 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -40,7 +40,7 @@
 
 NFD_LOG_INIT(Forwarder);
 
-const std::string CFGSEC_FORWARDER = "forwarder";
+const std::string CFG_FORWARDER = "forwarder";
 
 static Name
 getDefaultStrategyName()
@@ -607,7 +607,9 @@
 void
 Forwarder::setConfigFile(ConfigFile& configFile)
 {
-  configFile.addSectionHandler(CFGSEC_FORWARDER, bind(&Forwarder::processConfig, this, _1, _2, _3));
+  configFile.addSectionHandler(CFG_FORWARDER, [this] (auto&&... args) {
+    processConfig(std::forward<decltype(args)>(args)...);
+  });
 }
 
 void
@@ -618,10 +620,10 @@
   for (const auto& pair : configSection) {
     const std::string& key = pair.first;
     if (key == "default_hop_limit") {
-      config.defaultHopLimit = ConfigFile::parseNumber<uint8_t>(pair, CFGSEC_FORWARDER);
+      config.defaultHopLimit = ConfigFile::parseNumber<uint8_t>(pair, CFG_FORWARDER);
     }
     else {
-      NDN_THROW(ConfigFile::Error("Unrecognized option " + CFGSEC_FORWARDER + "." + key));
+      NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_FORWARDER + "." + key));
     }
   }
 
diff --git a/daemon/fw/retx-suppression-fixed.cpp b/daemon/fw/retx-suppression-fixed.cpp
index dddd742..50ade91 100644
--- a/daemon/fw/retx-suppression-fixed.cpp
+++ b/daemon/fw/retx-suppression-fixed.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2021,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -44,9 +44,9 @@
     return RetxSuppressionResult::NEW;
   }
 
-  time::steady_clock::TimePoint lastOutgoing = getLastOutgoing(pitEntry);
-  time::steady_clock::TimePoint now = time::steady_clock::now();
-  time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing;
+  auto lastOutgoing = getLastOutgoing(pitEntry);
+  auto now = time::steady_clock::now();
+  auto sinceLastOutgoing = now - lastOutgoing;
   bool shouldSuppress = sinceLastOutgoing < m_minRetxInterval;
   return shouldSuppress ? RetxSuppressionResult::SUPPRESS : RetxSuppressionResult::FORWARD;
 }
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 9cfb3be..8762e24 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -291,13 +291,13 @@
     return fibEntry;
   }
 
-  const DelegationList& fh = interest.getForwardingHint();
+  const auto& fh = interest.getForwardingHint();
   // Forwarding hint should have been stripped by incoming Interest pipeline when reaching producer region
   BOOST_ASSERT(!m_forwarder.getNetworkRegionTable().isInProducerRegion(fh));
 
   const fib::Entry* fibEntry = nullptr;
-  for (const Delegation& del : fh) {
-    fibEntry = &fib.findLongestPrefixMatch(del.name);
+  for (const auto& delegation : fh) {
+    fibEntry = &fib.findLongestPrefixMatch(delegation.name);
     if (fibEntry->hasNextHops()) {
       if (fibEntry->getPrefix().size() == 0) {
         // in consumer region, return the default route
@@ -305,7 +305,7 @@
       }
       else {
         // in default-free zone, use the first delegation that finds a FIB entry
-        NFD_LOG_TRACE("lookupFib delegation=" << del.name << " found=" << fibEntry->getPrefix());
+        NFD_LOG_TRACE("lookupFib delegation=" << delegation.name << " found=" << fibEntry->getPrefix());
       }
       return *fibEntry;
     }
