improve deadlock fix