bug fix main thread