fixing bug in db::count