     (bit-count datamap))
 
   (get-node [_ i]
-    (aget arr (- (alength arr) 1 i)))
+    (aget arr (- (alength arr) i)))
 
   (get-array [_]
     arr)


  (inode-seq [inode]
    (let [nodes (make-array 7)
          cursors-lengths (make-array 14)]
      (aset nodes 0 inode)
      (aset cursors-lengths 0 0)
      (aset cursors-lengths 1 (.node-arity inode))
      (if (zero? datamap)
        (create-inode-seq arr 0 nodes cursors-lengths 0 (.data-arity inode))
        (NodeSeq. nil arr 0 nodes cursors-lengths 0 (.data-arity inode) nil))))

          cursors-lengths (aclone cursors-lengths)]
      (loop [lvl lvl]
        (when (>= lvl 0)
          (let [node-idx (aget cursors-lengths lvl)]
            (if (zero? node-idx)
              (recur (dec lvl))
              (let [node (.get-node (aget nodes lvl) node-idx)
                    has-nodes ^boolean (.has-nodes? node)
                    new-lvl (if has-nodes (inc lvl) lvl)]
                (aset cursors-lengths lvl (dec node-idx))
                (when has-nodes
                  (aset nodes new-lvl node)
                  (aset cursors-lengths new-lvl (.node-arity node)))
                (if ^boolean (.has-data? node)
                  (NodeSeq. nil (.get-array node) new-lvl nodes cursors-lengths 0 (.data-arity node) nil)
                  (recur (inc lvl)))))))))))

(extend-protocol IPrintWithWriter
  NodeSeq
