                                     (terminal?       [s] false)
                                     (refine-input    [s ni] (refine-input inner-sp ni)))
         child-watch (fn child-watch [o]
-                      (if (= (output-set inner-sp) (output-set o))
+                      (if (=-state-sets (output-set inner-sp) (output-set o))
                         (do (connect-and-watch! ret o child-watch)
                             (summaries/summary-changed! ret))
-                        (do (util/assert-is (= (first (stub-name (stub o))) :OS))
-                            (util/assert-is (= (state/current-context (output-set inner-sp))
-                                               (state/current-context (output-set o))) "%s" [stb inner-sp])
+                        (do (util/assert-is (#{:OS :SA} (first (stub-name (stub o)))))
                             (add-sp-child! ret o))))]
     (connect-and-watch! ret inner-sp child-watch)    
     ret))

    (connect-subsuming! ret subsuming-sp)
    (output-wrap ret)))

;; TODO: do something more with subsuming?
(defn- get-atomic-stub [subsuming-sp inp-set function-set]
  (let [full-name [:Atomic (fs/fs-name function-set)
                   (if *state-abstraction* (fs/extract-context function-set inp-set) inp-set)]
        name [:Atomic (fs/fs-name function-set)]]
    (if-let [^HashMap dc *decompose-cache*]
      (if-let [cache-val (.get dc full-name)]
        (if *state-abstraction* 
          (make-state-abstracted-stub cache-val inp-set)
          cache-val)
        (let [in (if *state-abstraction* (fs/get-logger function-set inp-set) inp-set)
              stub (make-atomic-stub name subsuming-sp in function-set)]
          (.put dc full-name stub)
          (if *state-abstraction* 
          (make-state-abstracted-stub stub inp-set) ;; TODO: needed?
          stub)))
     (make-atomic-stub name subsuming-sp inp-set function-set))))




(declare make-fs-seq-stub get-atomic-stub)


(defn- make-atomic-subproblem [stub function-set subsuming-sp out-set reward status]
  (let [inp-set  (input-set stub)
