fix bug for read/write mask when changed.