         (set! state res)
         ;; Use = to determine equality from reactions, since
         ;; they are likely to produce new data structures.
-        (when (and (some? watches)
-                   (not= oldstate res))
+        (when-not (or (nil? watches)
+                      (= oldstate res))
           (-notify-watches this oldstate res)))
       res))
 

  (_set-state [this oldstate newstate]
    (when-not (identical? oldstate newstate)
      (set! state newstate)
      (when (some? watches)
        (-notify-watches this oldstate newstate))))

  IDeref

(defn- cached-reaction [f key obj destroy]
  (if-some [r (get cached-reactions key)]
    (-deref r)
    (if-not (nil? *ratom-context*)
      (let [r (make-reaction
               f :on-dispose (fn [x]
                               (set! cached-reactions
                                     (dissoc cached-reactions key))
                               (when-not (nil? obj)
                                 (set! (.-reaction obj) nil))
                               (when-not (nil? destroy)
                                 (destroy x))
                               nil))
            v (-deref r)]
        (set! cached-reactions (assoc cached-reactions key r))
        (when-not (nil? obj)
          (set! (.-reaction obj) r))
        v)
      (f))))
