thread creation error checking