Fixed flakes and readded missing Thread import