fix bugs in database.DatabaseIO