 
 (defun ensure-specware-running ()
   (unless (inferior-lisp-running-p)
-    (if *specware-auto-start*
-	(progn (run-specware4)
-	       (sit-for 0.5))
-      (error "Specware not running. Do M-x run-specware4"))))
+    (sit-for 0.5)
+    (unless (inferior-lisp-running-p)
+      (if *specware-auto-start*
+	  (progn (run-specware4)
+		 (sit-for 0.5))
+	(error "Specware not running. Do M-x run-specware4")))))
 
 ;; (simulate-input-expression "t")
 (defun simulate-input-expression (str)

	     nil))
	 (specware4-lisp (concat lisp-dir "/Specware4.lisp"))
	 (specware4-base-lisp (concat specware4-dir "/Applications/Specware/Specware4-base.lisp")))
    (run-plain-lisp)
    (sw:eval-in-lisp-no-value
     (format "(load %S)"
	     (concat specware4-dir "/Applications/Handwritten/Lisp/load-utilities")))

	     (sleep-for 5)
	     (while (inferior-lisp-running-p)
	       (sleep-for 2))
	     (run-plain-lisp 1)
	     (simulate-input-expression "(load \"load.lisp\")")
	     (simulate-input-expression "(Bootstrap-Spec::compileAll)")))))

