added some mutex stuff