improved mutex use