fixed multithread bug