fixed deadlocking bug