                                  (or (eq (cl-cadar err) 'connection-failed)
                                      (eq (caar err) 'file-error)))
                             (setf retrying t)
-                            (let ((old-port tern-known-port))
+                            (let ((old-port (tern-known-port)))
                               (setf tern-known-port nil)
                               (if tern-explicit-port
                                   (funcall callback nil err)

  (set (make-local-variable 'tern-explicit-port) nil)
  (set (make-local-variable 'tern-project-dir) nil)
  (set (make-local-variable 'tern-last-file-name) nil)
  (set (make-local-variable 'tern-last-point-pos) nil)
  (set (make-local-variable 'tern-last-completions) nil)
  (set (make-local-variable 'tern-last-argument-hints) nil)

(defvar tern-explicit-port nil)
(defvar tern-project-dir nil)
(defvar tern-last-file-name nil)
(defvar tern-last-project-dir nil)

(defun tern-message (fmt &rest objects)
  (apply 'message fmt objects))
