added some mutex code