       (throw (Exception.
                (format "Cannot connect ugen arguments for %s ugen with args: %s" (:name ugen) (str (seq (:args ugen)))))))
 
-    ugen))
+    ;;Add link back to MaxLocalBufs ugen (always at root of tree) if
+    ;;ugen is a local-buf.
+    (if (= "LocalBuf" (:name ugen))
+      (assoc ugen :inputs (concat (:inputs ugen) {:src 0 :index 0}))
+      ugen)))
 
 ; TODO: Currently the output rate is hard coded to be the same as the
 ; computation rate of the ugen.  We probably need to have some meta-data

            (let [[ugens# constants#] (gather-ugens-and-constants
                                        (with-overloaded-ugens ~@ugen-form))
                  ugens# (topological-sort-ugens ugens#)
;;                  _# (println "main-tree[" (count ugens#) "]: " ugens#)
;;                  _# (println (str "*ugens*: [" (count *ugens*) "] " *ugens*))
                  main-tree# (set ugens#)
                  side-tree# (filter #(not (main-tree# %)) *ugens*)
;;                  _# (println "side-tree[" (count side-tree#) "]: " side-tree#)
                  ugens# (concat ugens# side-tree#)
                  constants# (into [] (set (concat constants# *constants*)))]
;;              (println "all ugens[" (count ugens#) "]: " ugens#)
       [~sname ~params ugens# constants#])))))

(defsynth bar [freq 220] (out 0 (rlpf (saw [freq (* 3.013 freq)]) (x-line:kr 20000 2 1 FREE))))
(definst faz [] (rlpf (saw [220 663]) (x-line:kr 20000 2 1 FREE)))
(definst baz [freq 220] (rlpf (saw [freq (* 3.013 freq)]) (x-line:kr 20000 2 1 FREE)))
(run 1 (out 184 (saw (x-line:kr 10000 10 1 FREE)))))

(defn count-ugens
  [ug-tree ug-name]
  (let [ugens      (flatten  ug-tree)
        local-bufs (filter #(= ug-name (:name %)) ugens)
        ids        (set (map :id local-bufs))]
    (count ids)))

(defmacro pre-synth
  "Resolve a synth def to a list of its name, params, ugens (nested if
