chore(thread): fix flush environment