   (reset [this]
          (assert (> (alength marked-nodes) 0))
          (assert (> (alength marked-ixes) 0))
-         (set! node (.pop nodes))
+         (set! node (.pop marked-nodes))
          (set! ix (.pop marked-ixes))))
 
 (defn iterator [tree]

  (maintain [this]
            (set! end? (.-end? (aget key-ix->intersection key-ix))))
  (next [this]
        (when (false? end)
          (.next (aget key-ix->intersection key-ix))
          (.maintain this)))
  (seek [this key]
        (when (false? end)
          (.seek (aget key-ix->intersection key-ix) key)
          (.maintain this)))
  (down [this]

         (.reset iterator)))

(defn trieterator [iterator]
  (Trieterator. iterator (least-key (.-key-len iterator)) nil -1 0 (.-end? iterator) (.-key-len iterator)))

;; works on trees
(deftype Intersection [iterators ^:mutable end? key-len]
