Fixed mutex bug