Fix thread operations