 		guard compiler.compile(context: mContext, sourceFiles: mScripts, console: console, config: conf) else {
 			console.error(string: "Failed to compile  user scripts")
 			mTerminationStatus = 1
+			mThreadState       = .Finished
 			return
 		}
 

		} else {
			mTerminationStatus = 0
		}
	}
}


		compiler.defineBuiltinFunctions(parentThread: self, context: mContext)
	}

	public var threadState: ThreadState {
		get { return mThreadState }
	}

	public override var terminationStatus: Int32 {
		get { return mTerminationStatus }
	}

	public func start(userScripts scripts: Array<URL>, arguments args: Array<String>) {
		mScripts   	= scripts
		mArguments 	= args
		mThreadState	= .Running
		super.start()
	}

	public override func main() {
		guard let conf = config as? KHConfig else {
			NSLog("Can not happen")
			mThreadState = .Finished
			return
		}

