   (let [c-val (state/get-var s v)
         dtg   (get-in dtgs [v c-val])
         child (current-child s cvm v)
-        d-val (-> (state/get-var s (action-var child)) :precond-map (util/safe-get v))]
+        d-val (-> (state/get-var s (action-var child)) :precond-map (get v))]
     ;;    (when greedy? #_ (util/assert-is (not (= c-val d-val)) "%s" (def *s* s)))
-    (if (= c-val d-val)
-      [(make-freeze-var-action v)]
-      (for [n-val (acyclic-succ-fn v c-val d-val), a (dtg n-val)]
-        (make-add-action-action a)))))
+    (if d-val 
+      (if (= c-val d-val)
+        [(make-freeze-var-action v)]
+        (for [n-val (acyclic-succ-fn v c-val d-val), a (dtg n-val)]
+          (make-add-action-action a)))
+      ;; This should only arise in cyclic domains -- TODO: remove?
+      (add-actions s v dtgs))))
+
 
 
 


 ; (doseq [[alg sp]  [[make-asplan-env asplan-solution-pair-name] [angelic.search.action-set.asplan-broken/make-asplan-env angelic.search.action-set.asplan-broken/asplan-solution-pair-name]] ] (println (time (run-counted #(sp (uniform-cost-search (alg (make-random-infinite-taxi-sas2 3 3 3 3))))))))









;; (use 'angelic.env 'angelic.hierarchy 'angelic.search.textbook 'angelic.domains.taxi-infinite 'angelic.search.action-set.asplan  'angelic.domains.sas-problems 'angelic.sas 'angelic.sas.analysis 'edu.berkeley.ai.util 'angelic.sas.hm-heuristic)

;; (let [e (make-random-infinite-taxi-sas2 4 4 4 2)] (println (time (run-counted #(uniform-cost-search e)))) (println (time (run-counted #(asplan-solution-pair-name (uniform-cost-search (make-asplan-env e)))))))

