Fix deadlock.
Merge pull request #8 from meshell/FixDeadlock

Fix deadlock.