diff --git a/tests/chunks/pipeline-interests-fixed-window.t.cpp b/tests/chunks/pipeline-interests-fixed-window.t.cpp
index c4d4aad..e75b4a2 100644
--- a/tests/chunks/pipeline-interests-fixed-window.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed-window.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2016-2018, Regents of the University of California,
+ * Copyright (c) 2016-2019, Regents of the University of California,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University.
  *
@@ -21,6 +21,7 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  *
  * @author Andrea Tosatto
+ * @author Chavoosh Ghasemi
  */
 
 #include "tools/chunks/catchunks/pipeline-interests-fixed-window.hpp"
@@ -61,53 +62,23 @@
 BOOST_AUTO_TEST_SUITE(Chunks)
 BOOST_FIXTURE_TEST_SUITE(TestPipelineInterestsFixedWindow, PipelineInterestFixedWindowFixture)
 
-BOOST_AUTO_TEST_CASE(FewerSegmentsThanPipelineCapacity)
-{
-  nDataSegments = 3;
-  BOOST_ASSERT(nDataSegments <= opt.maxPipelineSize);
-
-  runWithData(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1), 1);
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), nDataSegments - 1);
-
-  for (uint64_t i = 1; i < nDataSegments - 1; ++i) {
-    face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1), 1);
-
-    BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 1);
-    BOOST_REQUIRE_EQUAL(face.sentInterests.size(), nDataSegments - 1);
-    // check if the interest for the segment i+1 is well formed
-    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(getSegmentFromPacket(sentInterest), i + 1);
-  }
-
-  BOOST_CHECK_EQUAL(hasFailed, false);
-
-  advanceClocks(io, ndn::DEFAULT_INTEREST_LIFETIME, opt.maxRetriesOnTimeoutOrNack + 1);
-  BOOST_CHECK_EQUAL(hasFailed, true);
-}
-
 BOOST_AUTO_TEST_CASE(FullPipeline)
 {
   nDataSegments = 13;
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
-  runWithData(*makeDataWithSegment(nDataSegments - 1));
+  run(name);
   advanceClocks(io, time::nanoseconds(1), 1);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   for (uint64_t i = 0; i < nDataSegments - 1; ++i) {
     face.receive(*makeDataWithSegment(i));
     advanceClocks(io, time::nanoseconds(1), 1);
-    BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 2);
+    BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 1);
 
-    if (i < nDataSegments - opt.maxPipelineSize - 1) {
+    if (i < nDataSegments - opt.maxPipelineSize) {
       BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize + i + 1);
-      // check if the interest for the segment i+1 is well formed
+      // check if the interest for the segment i is well formed
       const auto& sentInterest = face.sentInterests[i];
       BOOST_CHECK_EQUAL(sentInterest.getExclude().size(), 0);
       BOOST_CHECK_EQUAL(sentInterest.getMaxSuffixComponents(), 1);
@@ -117,11 +88,14 @@
     }
     else {
       // all the interests have been sent for all the segments
-      BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments - 1);
+      BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments);
     }
   }
 
   BOOST_CHECK_EQUAL(hasFailed, false);
+
+  advanceClocks(io, ndn::DEFAULT_INTEREST_LIFETIME, opt.maxRetriesOnTimeoutOrNack + 1);
+  BOOST_CHECK_EQUAL(hasFailed, true);
 }
 
 BOOST_AUTO_TEST_CASE(TimeoutAllSegments)
@@ -129,14 +103,14 @@
   nDataSegments = 13;
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
-  runWithData(*makeDataWithSegment(nDataSegments - 1));
+  run(name);
   advanceClocks(io, time::nanoseconds(1), 1);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   for (int i = 0; i < opt.maxRetriesOnTimeoutOrNack; ++i) {
     advanceClocks(io, opt.interestLifetime, 1);
     BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * (i + 2));
-    BOOST_CHECK_EQUAL(pipeline->m_nReceived, 1);
+    BOOST_CHECK_EQUAL(pipeline->m_nReceived, 0);
 
     // A single retry for every pipeline element
     for (size_t j = 0; j < opt.maxPipelineSize; ++j) {
@@ -157,7 +131,7 @@
   nDataSegments = 18;
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
-  runWithData(*makeDataWithSegment(nDataSegments - 1));
+  run(name);
   advanceClocks(io, time::nanoseconds(1), 1);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
@@ -170,7 +144,7 @@
 
   // send a single data packet for each pipeline element
   advanceClocks(io, opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack - 1);
-  for (uint64_t i = 0; i < opt.maxPipelineSize - 1; ++i) {
+  for (uint64_t i = 0; i < opt.maxPipelineSize; ++i) {
     face.receive(*makeDataWithSegment(opt.maxPipelineSize + i));
     advanceClocks(io, time::nanoseconds(1), 1);
   }
@@ -183,7 +157,7 @@
 
   // these new segments should not generate new interests
   advanceClocks(io, opt.interestLifetime, 1);
-  for (uint64_t i = 0; i < opt.maxPipelineSize - 1; ++i) {
+  for (uint64_t i = 0; i < opt.maxPipelineSize; ++i) {
     face.receive(*makeDataWithSegment(opt.maxPipelineSize * 2 + i - 1));
     advanceClocks(io, time::nanoseconds(1), 1);
   }
@@ -202,7 +176,7 @@
   nDataSegments = 22;
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
-  runWithData(*makeDataWithSegment(nDataSegments - 1, false));
+  run(name);
   advanceClocks(io, time::nanoseconds(1), 1);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
@@ -231,8 +205,8 @@
   BOOST_CHECK_EQUAL(hasFailed, false);
 
   // data for all the pipeline element, but not the second (segment #1)
-  for (uint64_t i = opt.maxPipelineSize; i < nDataSegments - 1; ++i) {
-    if (i == nDataSegments - 2) {
+  for (uint64_t i = opt.maxPipelineSize; i < nDataSegments; ++i) {
+    if (i == nDataSegments - 1) {
       face.receive(*makeDataWithSegment(i, true));
     }
     else {
@@ -255,7 +229,7 @@
   nDataSegments = 22;
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
-  runWithData(*makeDataWithSegment(nDataSegments - 1, false));
+  run(name);
   advanceClocks(io, time::nanoseconds(1), 1);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
@@ -272,11 +246,11 @@
   BOOST_CHECK_EQUAL(hasFailed, false);
 
   // data for the first pipeline element (segment #0), this should trigger an error because the
-  // others pipeline elements failed
+  // other pipeline elements failed
   face.receive(*makeDataWithSegment(0, false));
   advanceClocks(io, time::nanoseconds(1), 1);
 
-  BOOST_CHECK_EQUAL(pipeline->m_nReceived, 2);
+  BOOST_CHECK_EQUAL(pipeline->m_nReceived, 1);
   BOOST_CHECK_EQUAL(hasFailed, true);
 }
 
@@ -285,13 +259,13 @@
   nDataSegments = 13;
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
-  runWithData(*makeDataWithSegment(nDataSegments - 1));
+  run(name);
   advanceClocks(io, time::nanoseconds(1), 1);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   // send nack for all the pipeline elements first interest
-  for (size_t j = 0; j < opt.maxPipelineSize; j++) {
-    auto nack = make_shared<lp::Nack>(face.sentInterests[j]);
+  for (size_t i = 0; i < opt.maxPipelineSize; i++) {
+    auto nack = make_shared<lp::Nack>(face.sentInterests[i]);
     nack->setReason(lp::NackReason::CONGESTION);
     face.receive(*nack);
     advanceClocks(io, time::nanoseconds(1), 1);
