fixed a deadlock