                             (aclear inputs)
                             (set!! current-key key)
                             (set!! current-limit (aget key limit-ix))
-                            (set!! current-index 0))
-                          (when (< current-index current-limit)
+                            (set!! current-index 1))
+                          (when (<= current-index current-limit)
                             (let [input (aclone key)]
                               (apush input current-index)
                               (set!! current-index (+ current-index 1))

  (run [this kn rule->dirty? kind->name->rules]
       (let [current-key nil
             current-limit nil
             current-index 0
             inputs #js []
             aggs (make-array (alength agg-ixes))
             facts&vals #js []

                              in-var)
                agg-out-vars (for [[_ in-var agg-fun out-var] (@rule-id->agg-over rule-id)]
                               out-var)
                in-vars (into-array (distinct (concat group-by-vars [limit] (vals sort-by-vars) agg-in-vars)))
                out-vars (into-array (distinct (concat group-by-vars [limit] (vals sort-by-vars) agg-in-vars [ordinal] agg-out-vars)))
                var->ix (into {}
                              (for [i (range (alength out-vars))]
                                [(aget out-vars i) i]))
                index (.get-or-create-index kn "know" agg-index-id in-vars)
                group-len (count (conj (set group-by-vars) limit))
                limit-ix (var->ix limit)
                ascending? (= ascending|descending "ascending")
                agg-ixes (into-array
