fix a deadlock bug in client