Fix thread trouble