refix deadlock problem