fixed some mutex stuff