   a header structure and a sequence of chromosome data."
   [^BIGWIGReader rdr]
   (let [r ^RandomAccessFile (.reader rdr)]
-    (.seek r 0)
-    (let [headers (read-all-headers r)
-          bbi-chrom-info (read-bbi-chrom-info r (:bpt-header headers))]
-      {:headers headers, :bbi-chrom-info bbi-chrom-info})))
+    (let [bbi-chrom-info (read-bbi-chrom-info r (:bpt-header (.headers rdr)))]
+      {:headers (.headers rdr), :bbi-chrom-info bbi-chrom-info})))

(defn- read-all-headers
  "Returns the all headers of bigWig format."
  [^RandomAccessFile r]
  (let [fixed-width-header (read-fixed-width-header r)
        zoom-headers (read-zoom-headers r fixed-width-header)
        total-summary (read-total-summary r fixed-width-header)

  to ensure the reader is properly closed."
  [f]
  (let [f (.getAbsolutePath (cio/file f))
        reader (RandomAccessFile. f "r")
        headers (read-all-headers reader)]
    (BIGWIGReader. reader (util/as-url f) headers)))

(defn- check-bigwig-magic
  "Checks if the magic is right for bigWig format. Otherwise, throws IOException."
