A random bag of fixes. Most importantly fixes issues with all mutexes not working as expected!