         top-label (. gen newLabel)
         env (assoc env :top-label top-label)]
     (. gen visitCode)
-    (. gen mark top-label)
     (when rest-id
       (emit-list-from-array gen #(. gen loadArg (count params)))
-      (. gen storeLocal rest-id))
+      (. gen storeLocal rest-id)
+      (. gen visitInsn Opcodes/ACONST_NULL)
+      (. gen storeArg (count params)))
+
+    (. gen mark top-label)
     (emit-body env :context/return gen body)
     (. gen returnValue)
     (. gen endMethod)))

          (list 'let (list (list res (explode-invocation call)))
                res))))

(defn emit-tail-call
  [{:keys [recur-sym restarg top-label params] :as env} ^GeneratorAdapter gen [fun & args :as call]]
  (if (= fun recur-sym)
                                        ; Self call, becomes loop
    (do
      (debug "emitting self tail-call: " call)
      (when (or (and restarg (< (count args) (count params)))
                (not= (count args) (count params)))
        (throw (IllegalArgumentException.
                (str "Wrong number of args (" (count args) " for " (count params) (when restarg "+") ")"))))
                                        ; emit all new values
      (dotimes [n (count params)]
        (emit env :context/expression gen (nth args n)))
      (when restarg
        (let [extra (seq (drop (count params) args))]
          (AsmUtil/pushInt gen (count extra))
          (. gen newArray object-type)
          (dotimes [n (count extra)]
            (. gen dup)
            (AsmUtil/pushInt gen n)
            (emit env :context/expression gen (nth extra n))
            (. gen arrayStore object-type))))
                                        ; store them in reverse order from stack
      (dotimes [n (count params)]
        (. gen storeArg (- (count params) n (if restarg 0 1))))
      (. gen goTo top-label))
                                        ; Calls another fn, return continuation thunk
    (do

    (cons 'lambda (sanitize-method env params body))))

(defn sanitize-case-lambda
  [env [_ & methods :as form]]
  (cons 'case-lambda
        (for [[params & body] (validate-arities methods)]
          (sanitize-method env params body))))
