     (remove-hook 'after-change-functions 'live-py-after-change-function t)
     (remove-hook 'post-command-hook 'live-py-check-to-scroll t)
     (remove-hook 'kill-buffer-hook 'live-py-mode-off t)
-    (ignore-errors (kill-buffer live-py-output-buffer))
+    (ignore-errors (kill-buffer live-py-trace-buffer))
     (when (window-valid-p live-py-output-window)
       (delete-window live-py-output-window))
     (toggle-truncate-lines 0))))

         (process-environment (cons pythonpath process-environment))
         (default-directory live-py-dir)
         (reused-buffer (buffer-live-p
                         (and live-py-output-buffer
                              (get-buffer live-py-output-buffer)))))
    (save-restriction
      (widen)
      (setq-local
       live-py-lighter
       ;; Create (or recreate) if necessary, update and last but not least
       ;; display output buffer.
       (if (eq 0 (shell-command-on-region 1
                                          (1+ (buffer-size))
                                          command-line
                                          live-py-output-buffer))
           " live"
         " live(FAIL)")))
    (with-current-buffer live-py-output-buffer
      (setq-local buffer-read-only 1)
      (unless reused-buffer (toggle-truncate-lines 1)))
    (live-py-synchronize-scroll

;; Internal variables.
(defvar live-py-output-window nil)
(defvar-local live-py-timer nil)
(defvar-local live-py-trace-buffer nil "The name of the trace buffer.")
(defvar-local live-py-module nil)
(defvar-local live-py-parent nil)
(defvar-local live-py-window-start-pos nil)
