fixed a pointer bug which caused a deadlock