 
 (defn- read-to-finish
   [^BAMReader rdr
+   ^Long start
    ^Long finish
    ^clojure.lang.IFn read-fn]
   (let [r ^BGZFInputStream (.reader rdr)]
-    (when (and (not (zero? (.available r)))
-               (> finish (.getFilePointer r)))
-      (cons (read-fn rdr (.refs rdr))
-            (lazy-seq (read-to-finish rdr finish read-fn))))))
+    (when (< start finish)
+      (.seek r start)
+      (when-not (zero? (.available r))
+        (let [result (read-fn rdr (.refs rdr))
+              curr (.getFilePointer r)]
+          (cons result
+                (lazy-seq (read-to-finish rdr curr finish read-fn))))))))
 
 (defn- read-alignments-first-only
   "It should be equivalent to [(first (filter window @candidates))]"

                  :deep read-alignment
                  :pointer pointer-read-alignment)
        candidates (flatten (map (fn [[^Long begin ^Long finish]]
                                   (.seek ^BGZFInputStream (.reader rdr) begin)
                                   (read-to-finish rdr finish read-fn)) spans))]
    (if (= deep-or-shallow :first-only)
      (read-alignments-first-only rdr spans window read-fn)
      (filter window candidates))))

  (loop [left-spans spans]
    (when-let [span (first left-spans)]
      (let [[^Long begin ^Long finish] span]
        (or
          (loop [left (read-to-finish rdr begin finish read-fn)]
            (when-let [one (first left)]
              (if (window one)
                [one]
