   [num-images image-queue]
   (run-sequence-acquisition num-images false)
   (dotimes [i num-images]
-        (when-let [image (pop-next-image)]
-          (.put image-queue image))))
+    (when-let [image (pop-next-image)]
+      (when image-queue
+        (.put image-queue image)))))
 
 (defn byte-buffer-queue
   "Run a sequence acquisition, convert the incoming

          (println filename)
          (dotimes-timed [i num-images] 100
            (let [buffer (.take buffer-queue)]
              (.write channel buffer))))
        (catch Exception e (println e))
        (finally (.close file)))
      filename))

     (println '~(first bindings) "time (ms)")
     (dotimes ~bindings
       (when (zero? (mod ~(first bindings) ~interval))
         (println ~(first bindings) (- (System/currentTimeMillis) t0#)
                  (core getRemainingImageCount)))
       ~@body)))

(defn write-buf [channel buffer]
  (.write channel buffer)
  )

(defn acquire-and-save
  "Simulate running a sequence acquisition, and save the
   images to a file using the direct byte buffer method."
  [num-images]
    (let [filename (str "D:/AcquisitionData/test" (rand-int 100000) ".dat")
          file (RandomAccessFile. filename "rw")
          channel (.getChannel file)]
      (try
