       "Channel" (get-in event [:channel :name])
       "PixelType" "GRAY8"
       "ZPositionUm" (get event :slice)
-      "AxisPositions" (JSONObject. (get-in event [:position :axes]))
+      "AxisPositions" (when-let [axes (get-in event [:position :axes])] (JSONObject. axes))
     )))  
     
 (defn annotate-image [img event]

(defn make-event-fns [event out-queue]
  (let [event (compute-z-position event)]
    (list
		#(run-actions (create-presnap-actions event))
		#(await-for 10000 (device-agents (. mmc getCameraDevice)))
		#(when-let [wait-time-ms (event :wait-time-ms)]
		  (acq-sleep wait-time-ms))
		#(when (:autofocus event)
		  (store-z-correction (run-autofocus)))
		#(snap-image true (:close-shutter event))
		#(collect-image event out-queue)
    )))
  

;; globals

(declare last-wake-time)
(def start-time 0)
(declare interrupt-requests)
(declare z-corrections)

