Implemented the locks for INSTANCE_SAFE and FULLY_SAFE