       (fn [lo]
         (connect-and-watch! ret
           (make-pair-stub2 subsuming-sp lo (right-stub-fn (output-set lo)))
-          #(add-child-sp! ret %))
+          #(set-stub-output! ret %))
         (summaries/summary-changed! ret))) ;; TODO: wasteful?
     
     ret))

          (let [ret (make-simple-subproblem stub subsuming-sp out-set false or-summary ri-fn reward)]
            (connect-and-watch! ret subsuming-sp
              (fn [sub-out]
                (connect-and-watch! ret (refine-input sub-out inp-set) #(add-child-sp! ret %))
                (summaries/summary-changed! ret)))  ;; TODO: needed?                       
            ret)
          
          :else 
          (let [ret (make-simple-subproblem stub subsuming-sp out-set false or-summary ri-fn reward)]
            (doseq [child (map #(make-fs-seq-stub inp-set %) (fs/child-seqs function-set inp-set))]
              (connect-and-watch! ret child #(add-child-sp! ret %)))
            ret))))



    (add-watcher! watch
      (fn [o] ;        (println ret o)
        (summaries/summary-changed-local! ss)
        (connect-and-watch! ret (stub-f o) #(add-sp-child! ret %))
        (summaries/summary-changed! ret))) ;; TODO: efficiency?
    
    ret))
