Removing double mutex problem