database db read and write fixed