   (let ((filename (sw::file-to-specware-unit-id buffer-file-name))
 	(text (buffer-substring beg end)))
     (when (or (buffer-modified-p)
-	      (not (sw:eval-in-lisp "(Specware::unitIDCurrentInCache? %S)"
-				    buffer-file-name)))
+	      (let ((result 
+		     (sw:eval-in-lisp "(Specware::unitIDCurrentInCache? %S)"
+				      buffer-file-name)))
+		(member result '(nil NIL))))
       (sw:gcl-current-file)
       (sleep-for 1))			; Give :swll a chance to finish
     (unless (string-equal filename

		     (head-dir-uid (split-filename-for-path filename)))
		 (lisp-or-specware-command
		  ":swpath " "path "
		  oldpath
		  (if (eq window-system 'mswindows) ";" ":")
		  (car head-dir-uid))
		 (sleep-for 0.1)	; Just to avoid confusing output

		 sym)))
      (let ((results (sw:eval-in-lisp (make-search-form qualifier sym))))
	(message nil)
	(if (member results '(nil NIL))
	    (error "Can't find definition of %s." name)
	  (goto-specware-meta-point-definition sym results))))))

