Fixed an error condition for thread creation.