Fix mutex logic.
Merge pull request #2 from djspinmonkey/fix_mutex

Fix mutex logic.