Working version of mutex

This should have happened a while ago, but I wasn't in the mood.  Fixes mutex stuff on master.