fix core when thread fails to spawn.