fix db.write()