Index: /branches/eam_branches/ohana.20190329/src/opihi/cmd.data/interpolate_presort.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/cmd.data/interpolate_presort.c	(revision 40810)
+++ /branches/eam_branches/ohana.20190329/src/opihi/cmd.data/interpolate_presort.c	(revision 40811)
@@ -43,12 +43,7 @@
   y0 = yin[0].elements.Flt[0];
   
-  /* in and out vectors are sorted */
-  j = 0;
-  i = 0;
-
-  // fill in the rest with NANs
-  while (xout[0].elements.Flt[i] < xin[0].elements.Flt[0]) {
+  // fill in the start with NANs
+  for (i = 0; (i < xout[0].Nelements) && (xout[0].elements.Flt[i] < xin[0].elements.Flt[0]); i++) {
     yout[0].elements.Flt[i] = FillEnds ? yin[0].elements.Flt[0] : NAN;
-    i++;
   }
 
