fix thread hang issue