            (let [[ch msg] args]
              (swap! vis #(-> %
                              (assoc-in [:actxs actx :wait-chs ch] :put)
-                             (vis-add-ch ch)
+                             (vis-add-ch ch nil)
                              (assoc-in [:chs ch :msgs msg] true)))))
     :end (fn [vis actx args]
            (let [[ch msg result] args]


;; ------------------------------------------------

(defn vis-add-ch [vis ch]
  (update-in vis [:chs ch]
             (fn [v] (if (nil? v)
                       {:id ((:gen-id vis)) :msgs {} :first-taker-actx nil}
                       v))))

(def vis-event-handlers
  {"ago"

   "aalts"
   {:beg (fn [vis actx args]
           (let [[ch-bindings] args
                 ; The ch-actions will be [[ch :take] [ch :put] ...].
                 ch-actions (map #(if (seq? %) [(first %) :put] [% :take])
                                 ch-bindings)]
             (doseq [ch-action ch-actions]
               (swap! vis #(-> %
                               (vis-add-ch (first ch-action)
                                           (if (= (second ch-action) :take) actx nil))
                               (assoc-in [:actxs actx :wait-chs (first ch-action)]
                                         (second ch-action)))))))
    :end (fn [vis actx args]
           (let [[ch-bindings result] args
                 chs (map #(if (seq? %) (first %) %) ch-bindings)
