deadlock bug fix due to different thread