some updates to db save method and Database.new