solve the  multi thread problem