Fixed crash in read-only mode & added test for read-only access