     ;; the first one is a nil action at a nil
     ;; point
     (filter
-     (fn [segment] (refine-segment? segment corpus))
-     action-segments)))
+     second
+     (map
+      (fn [segment]
+        [segment (try (nth action-seq (count segment))
+                      (catch IndexOutOfBoundsException e nil))])
+      (filter
+       (fn [segment] (refine-segment? segment corpus))
+       action-segments)))))
 
 (defn leaf-fix?
   [action-seq corpus]

       fat))
     src-docs)))

(defn refine-model-with-positions
  "Try to maximize the model yield with position info"
  [model corpus]

           leaf-src-docs (map
                          (fn [u]
                            (:body (corpus u)))
                          leaf-src-urls)

           leaf-fix (first
                     (first
                      (max-key
                       second
                       (frequencies
                        (map
                         (fn [[u b]]
                           (if leaf-fix-decision
                             (dom/refine-xpath-accuracy (first action-seq)
                                                        b
                                                        u
                                                        leaf-muscle
                                                        leaf-fat)
                             {}))
                         (map vector leaf-src-urls leaf-src-docs))))))]
      [action-seq
       :segments-to-fix
       (cons
        [action-seq leaf-fix]
        (map
         (fn [[segment action]]
           (refine-segment segment action corpus))
         (seqs-to-refine action-seq
                         corpus)))]))
   model))
