Fix thread relationships