diff --git a/tests/chunks/pipeline-interests-fixed-window.t.cpp b/tests/chunks/pipeline-interests-fixed-window.t.cpp
index c6291dd..e9012f7 100644
--- a/tests/chunks/pipeline-interests-fixed-window.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed-window.t.cpp
@@ -1,8 +1,8 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2016,  Regents of the University of California,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University.
+ * Copyright (c) 2016-2017, Regents of the University of California,
+ *                          Colorado State University,
+ *                          University Pierre & Marie Curie, Sorbonne University.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -79,12 +79,12 @@
     BOOST_CHECK_EQUAL(nReceivedSegments, i);
     BOOST_REQUIRE_EQUAL(face.sentInterests.size(), nDataSegments - 1);
     // check if the interest for the segment i+1 is well formed
-    auto sentInterest = face.sentInterests[i];
+    const auto& sentInterest = face.sentInterests[i];
     BOOST_CHECK_EQUAL(sentInterest.getExclude().size(), 0);
     BOOST_CHECK_EQUAL(sentInterest.getMaxSuffixComponents(), 1);
     BOOST_CHECK_EQUAL(sentInterest.getMustBeFresh(), opt.mustBeFresh);
     BOOST_CHECK_EQUAL(Name(name).isPrefixOf(sentInterest.getName()), true);
-    BOOST_CHECK_EQUAL(sentInterest.getName()[-1].toSegment(), i + 1);
+    BOOST_CHECK_EQUAL(getSegmentFromPacket(sentInterest), i + 1);
   }
 
   BOOST_CHECK_EQUAL(hasFailed, false);
@@ -110,12 +110,12 @@
     if (i < nDataSegments - opt.maxPipelineSize - 1) {
       BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize + i + 1);
       // check if the interest for the segment i+1 is well formed
-      auto sentInterest = face.sentInterests[i];
+      const auto& sentInterest = face.sentInterests[i];
       BOOST_CHECK_EQUAL(sentInterest.getExclude().size(), 0);
       BOOST_CHECK_EQUAL(sentInterest.getMaxSuffixComponents(), 1);
       BOOST_CHECK_EQUAL(sentInterest.getMustBeFresh(), opt.mustBeFresh);
       BOOST_CHECK_EQUAL(Name(name).isPrefixOf(sentInterest.getName()), true);
-      BOOST_CHECK_EQUAL(sentInterest.getName()[-1].toSegment(), i);
+      BOOST_CHECK_EQUAL(getSegmentFromPacket(sentInterest), i);
     }
     else {
       // all the interests have been sent for all the segments
@@ -142,8 +142,8 @@
 
     // A single retry for every pipeline element
     for (size_t j = 0; j < opt.maxPipelineSize; ++j) {
-      auto interest = face.sentInterests[(opt.maxPipelineSize * (i + 1)) + j];
-      BOOST_CHECK_EQUAL(static_cast<size_t>(interest.getName()[-1].toSegment()), j);
+      const auto& interest = face.sentInterests[(opt.maxPipelineSize * (i + 1)) + j];
+      BOOST_CHECK_EQUAL(static_cast<size_t>(getSegmentFromPacket(interest)), j);
     }
   }
 
@@ -213,8 +213,8 @@
     face.receive(*makeDataWithSegment(i, false));
     advanceClocks(io, time::nanoseconds(1), 1);
 
-    auto lastInterest = face.sentInterests.back();
-    BOOST_CHECK_EQUAL(lastInterest.getName()[-1].toSegment(), opt.maxPipelineSize + i - 2);
+    const auto& lastInterest = face.sentInterests.back();
+    BOOST_CHECK_EQUAL(getSegmentFromPacket(lastInterest), opt.maxPipelineSize + i - 2);
   }
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * 3 - 2);
 
@@ -310,8 +310,8 @@
 
     // A single retry for every pipeline element
     for (size_t j = 0; j < opt.maxPipelineSize; ++j) {
-      auto interest = face.sentInterests[(opt.maxPipelineSize * i) + j];
-      BOOST_CHECK_LT(static_cast<size_t>(interest.getName()[-1].toSegment()), opt.maxPipelineSize);
+      const auto& interest = face.sentInterests[(opt.maxPipelineSize * i) + j];
+      BOOST_CHECK_LT(static_cast<size_t>(getSegmentFromPacket(interest)), opt.maxPipelineSize);
     }
 
     for (size_t j = 0; j < opt.maxPipelineSize; j++) {
