 (defn all-coordinators-exist 
   [replica]
   (every? (fn [coord]
-            (some #{coord} (:peers replica)))
+            (or (nil? coord)
+                (some #{coord} (:peers replica))))
           (vals (:coordinators replica))))
 
 (defn active-job-invariant


(defn all-jobs-have-coordinator
  [replica]
  (every? (fn [[job _]]
            (get-in replica [:coordinators job])) 
          (:allocations replica)))

(defn no-extra-coordinators

  (let [slot-id-peers (mapcat keys (vals (reduce merge (vals task-slot-ids))))]
    (and (= slot-id-peers (distinct slot-id-peers))
         (empty? (remove (set peers) slot-id-peers)))))

(defn all-groups-invariant
  [{:keys [groups prepared accepted pairs] 
