diff --git a/core/includes/session.inc b/core/includes/session.inc
index 57a8878..1912ba2 100644
--- a/core/includes/session.inc
+++ b/core/includes/session.inc
@@ -111,7 +111,7 @@ function _drupal_session_read($sid) {
     // Add roles element to $user.
     $user->roles = array();
     $user->roles[DRUPAL_AUTHENTICATED_ROLE] = TRUE;
-    $user->roles += db_query("SELECT r.name, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.role_name = r.name WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 1);
+    $user->roles += db_query("SELECT r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.role_name = r.name WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 0);
   }
   elseif ($user) {
     // The user is anonymous or blocked. Only preserve two fields from the
diff --git a/core/modules/block/block.install b/core/modules/block/block.install
index 07c8739..1146cee 100644
--- a/core/modules/block/block.install
+++ b/core/modules/block/block.install
@@ -224,7 +224,7 @@ function block_update_8001() {
   }
 
   db_drop_field('block_role', 'rid');
-  // Update the pimary key of the block_role table.
+  // Update the primary key of the block_role table.
   db_drop_primary_key('block_role');
   db_add_primary_key('block_role', array('module', 'delta', 'role_name'));
 
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 3687ec3..6c6ee7c 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1363,7 +1363,7 @@ function comment_node_update_index($node) {
     // not view comments.
     $index_comments = TRUE;
     foreach ($perms['search content'] as $role_name) {
-      if (!isset($perms['access comments'][$role_name]) && ($role_name == DRUPAL_ANONYMOUS_ROLE || !isset($perms['access comments'][DRUPAL_AUTHENTICATED_ROLE]))) {
+      if (!isset($perms['access comments'][$role_name]) && ($role_name == DRUPAL_ANONYMOUS_ROLE || $role_name == DRUPAL_AUTHENTICATED_ROLE || !isset($perms['access comments'][DRUPAL_AUTHENTICATED_ROLE]))) {
         $index_comments = FALSE;
         break;
       }
diff --git a/core/modules/field/modules/text/text.test b/core/modules/field/modules/text/text.test
index 0887e22..7c5b32f 100644
--- a/core/modules/field/modules/text/text.test
+++ b/core/modules/field/modules/text/text.test
@@ -213,8 +213,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
     $format_id = $format->format;
     $permission = filter_permission_name($format);
     $roles = $this->web_user->roles;
-    unset($roles[DRUPAL_AUTHENTICATED_ROLE]);
-    $role = key($roles);
+    $role = end(array_keys($roles));
     user_role_grant_permissions($role, array($permission));
     $this->drupalLogin($this->web_user);
 
diff --git a/core/modules/filter/filter.test b/core/modules/filter/filter.test
index c951b6b..a5565db 100644
--- a/core/modules/filter/filter.test
+++ b/core/modules/filter/filter.test
@@ -502,8 +502,7 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
   function testFormatRoles() {
     // Get the role name assigned to the regular user.
     $roles = $this->web_user->roles;
-    unset($roles[DRUPAL_AUTHENTICATED_ROLE]);
-    $role_name = key($roles);
+    $role_name = end(array_keys($roles));
 
     // Check that this role appears in the list of roles that have access to an
     // allowed text format, but does not appear in the list of roles that have
diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index 399b161..071412d 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -821,6 +821,7 @@ function theme_user_permission_description($variables) {
  */
 function user_admin_roles($form, $form_state) {
   $roles = db_select('role', 'r')
+    ->addTag('translatable')
     ->fields('r')
     ->orderBy('weight')
     ->execute()
diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index 9ae5672..ee60ba3 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -390,11 +390,11 @@ function user_update_8002() {
   // created earlier during the upgrade process.
   // @see update_prepare_d8_role_names().
 
-  // Set the new pimary key in the role_permission table.
+  // Set the new primary key in the role_permission table.
   db_drop_primary_key('role_permission');
   db_add_primary_key('role_permission', array('role_name', 'permission'));
 
-  // Set the new pimary key in the users_roles table..
+  // Set the new primary key in the users_roles table..
   db_drop_primary_key('users_roles');
   db_add_primary_key('users_roles', array('uid', 'role_name'));
 
@@ -407,7 +407,7 @@ function user_update_8002() {
     'description' => 'Old Primary Key: role ID. Use for upgrade purposes only!',
   );
   db_change_field('role', 'rid', 'rid', $column);
-  // Set the role name as pimary key.
+  // Set the role name as primary key.
   db_drop_primary_key('role');
   db_add_primary_key('role', array('name'));
 
diff --git a/core/modules/user/user.test b/core/modules/user/user.test
index 61dfb3c..b334a12 100644
--- a/core/modules/user/user.test
+++ b/core/modules/user/user.test
@@ -1230,8 +1230,7 @@ class UserAdminTestCase extends DrupalWebTestCase {
 
     // Filter the users by role. Grab the system-generated role name for User C.
     $roles = $user_c->roles;
-    unset($roles[DRUPAL_AUTHENTICATED_ROLE]);
-    $edit['role'] = key($roles);
+    $edit['role'] = end(array_keys($roles));
     $this->drupalPost('admin/people', $edit, t('Refine'));
 
     // Check if the correct users show up when filtered by role.
