little fixes in db.rb