Small mutex handling improvements