Fixed AI thread leaking out into the core code.