dynamic switching between read-write and read-only