Fix problem wth setting read-only bit on the database and supplement it with a check to see if the database exists