Use safer mutex

@djspinmonkey Does this look like the correct fix?