fix deadlock bugg