Fixed bug where edit mode can switch to read only mode and back again