Fix thread creation.