diff --git a/tests/daemon/face/websocket-channel-fixture.hpp b/tests/daemon/face/websocket-channel-fixture.hpp
index 69b2e9b..e6e1e9f 100644
--- a/tests/daemon/face/websocket-channel-fixture.hpp
+++ b/tests/daemon/face/websocket-channel-fixture.hpp
@@ -38,7 +38,8 @@
 {
 protected:
   shared_ptr<WebSocketChannel>
-  makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0, optional<size_t> mtu = nullopt) final
+  makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0,
+              optional<size_t> mtu = nullopt) final
   {
     if (port == 0)
       port = getNextPort();
@@ -55,7 +56,7 @@
     listenerChannel = makeChannel(addr, 20030);
     listenerChannel->setPingInterval(pingInterval);
     listenerChannel->setPongTimeout(pongTimeout);
-    listenerChannel->listen(bind(&WebSocketChannelFixture::listenerOnFaceCreated, this, _1));
+    listenerChannel->listen(std::bind(&WebSocketChannelFixture::listenerOnFaceCreated, this, _1));
   }
 
   void
@@ -65,9 +66,9 @@
     client.clear_error_channels(websocketpp::log::elevel::all);
 
     client.init_asio(&g_io);
-    client.set_open_handler(bind(&WebSocketChannelFixture::clientHandleOpen, this, _1));
-    client.set_message_handler(bind(&WebSocketChannelFixture::clientHandleMessage, this, _1, _2));
-    client.set_ping_handler(bind(&WebSocketChannelFixture::clientHandlePing, this, _1, _2));
+    client.set_open_handler(std::bind(&WebSocketChannelFixture::clientHandleOpen, this, _1));
+    client.set_message_handler(std::bind(&WebSocketChannelFixture::clientHandleMessage, this, _1, _2));
+    client.set_ping_handler(std::bind(&WebSocketChannelFixture::clientHandlePing, this, _1, _2));
 
     websocketpp::lib::error_code ec;
     auto con = client.get_connection(FaceUri(listenerEp, "ws").toString(), ec);
@@ -100,20 +101,16 @@
   listenerOnFaceCreated(const shared_ptr<Face>& newFace)
   {
     BOOST_REQUIRE(newFace != nullptr);
-    newFace->afterReceiveInterest.connect(bind(&WebSocketChannelFixture::faceAfterReceiveInterest, this, _1));
+    newFace->afterReceiveInterest.connect([this] (const auto& interest, const auto&) {
+      faceReceivedInterests.push_back(interest);
+      limitedIo.afterOp();
+    });
     connectFaceClosedSignal(*newFace, [this] { limitedIo.afterOp(); });
     listenerFaces.push_back(newFace);
     limitedIo.afterOp();
   }
 
   void
-  faceAfterReceiveInterest(const Interest& interest)
-  {
-    faceReceivedInterests.push_back(interest);
-    limitedIo.afterOp();
-  }
-
-  void
   clientHandleOpen(websocketpp::connection_hdl hdl)
   {
     clientHandle = hdl;
@@ -131,8 +128,8 @@
   clientHandlePing(websocketpp::connection_hdl, std::string)
   {
     auto now = time::steady_clock::now();
-    if (m_prevPingRecvTime != time::steady_clock::TimePoint()) {
-      measuredPingInterval = now - m_prevPingRecvTime;
+    if (m_prevPingRecvTime != time::steady_clock::time_point()) {
+      measuredPingIntervals.push_back(now - m_prevPingRecvTime);
     }
     m_prevPingRecvTime = now;
 
@@ -147,13 +144,13 @@
   websocketpp::connection_hdl clientHandle;
   std::vector<std::string> clientReceivedMessages;
 
-  time::steady_clock::Duration measuredPingInterval;
+  std::vector<time::nanoseconds> measuredPingIntervals;
   // set clientShouldPong to false to disable the pong response,
   // which will eventually cause a timeout in listenerChannel
   bool clientShouldPong = true;
 
 private:
-  time::steady_clock::TimePoint m_prevPingRecvTime;
+  time::steady_clock::time_point m_prevPingRecvTime;
 };
 
 } // namespace tests
