Readonly database bugfix