diff --git a/mongodb_session/mongodb_session.inc b/mongodb_session/mongodb_session.inc
index b22f481..cab0f44 100644
--- a/mongodb_session/mongodb_session.inc
+++ b/mongodb_session/mongodb_session.inc
@@ -110,7 +110,8 @@ function _drupal_session_read($sid) {
     // so next time we get it from Mongo.
     include_once dirname(__FILE__) . '/mongodb_session.module';
     $user->roles = array();
-    $user->roles = mongodb_session_user_insert(array(), $user);
+    $edit = array();
+    $user->roles = mongodb_session_user_insert($edit, $user, 'account');
   }
   // We found the client's session record and they are an authenticated,
   // active user.
diff --git a/mongodb_session/mongodb_session.install b/mongodb_session/mongodb_session.install
new file mode 100644
index 0000000..590e7c1
--- /dev/null
+++ b/mongodb_session/mongodb_session.install
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @file
+ * Install file.
+ */
+
+/**
+ * Update users to ensure their roles are saved to the user collection.
+ *
+ * Changes made to the session ensure that roles are saved to user accounts.
+ * However, user accounts may not have been stored with roles prior to this
+ * change and therefore those users will encounter access denied messages.
+ * This update will resave accounts with roles to ensure users have proper
+ * access.
+ */
+function mongodb_session_update_7101(&$sandbox) {
+  // Initialize the batch process.
+  if (!isset($sandbox['progress'])) {
+    $sandbox['progress'] = 0;
+    $sandbox['query']['_id']['$gt'] = 0;
+  }
+
+  // Get a user account to update.
+  $uids = mongodb_collection('fields_current', 'user')
+    ->find($sandbox['query'], array('_id' => 1))
+    ->sort(array('_id' => 1))
+    ->limit(1);
+
+  // Break point if we run out of users to work on.
+  $continue = $uids->hasNext();
+
+  // Perform the user update.
+  foreach ($uids as $uid) {
+    if (isset($uid['_id'])) {
+
+      $user = user_load($uid['_id']);
+      if ($user) {
+        user_save($user);
+      }
+      $sandbox['query']['_id']['$gt'] = $uid['_id'];
+
+    }
+    $sandbox['progress']++;
+  }
+
+  $sandbox['#finished'] = 0;
+  // If we hit the count or run out of users, then stop.
+  if (!$continue) {
+    $sandbox['#finished'] = 1;
+    return t('%num user accounts were updated.', array('%num' => $sandbox['progress']));
+  }
+}
diff --git a/mongodb_session/mongodb_session.module b/mongodb_session/mongodb_session.module
index aaaee70..4fd9875 100644
--- a/mongodb_session/mongodb_session.module
+++ b/mongodb_session/mongodb_session.module
@@ -15,6 +15,41 @@ function mongodb_session_simpletest_alter(&$groups) {
 }
 
 /**
+ * Implements hook_user_update().
+ */
+function mongodb_session_user_update(&$edit, $account, $category) {
+  // Update field values for changed values of the user.
+  $roles = _mongodb_session_get_roles($account);
+  // If mongodb_field_storage is enabled it will take care of creating
+  // initial user entry just add roles to it.
+  if (module_exists('mongodb_field_storage')) {
+    $save = array(
+      '$set' => array('roles' => $roles)
+    );
+  }
+  else {
+    $save = array(
+      '$set' => (array) $account + array(
+        '_bundle' => 'user',
+        'roles' => $roles,
+      ),
+    );
+    foreach (array('uid', 'created', 'access', 'login', 'status', 'picture') as $key) {
+      $save['$set'][$key] = (int) $save['$set'][$key];
+    }
+  }
+  mongodb_collection('fields_current', 'user')->update(array('_id' => (int) $account->uid), $save, array('upsert' => TRUE));
+  return $roles;
+}
+
+/**
+ * Implements hook_user_insert().
+ */
+function mongodb_session_user_insert(&$edit, $account, $category) {
+  return mongodb_session_user_update($edit, $account, $category);
+}
+
+/**
  * Implements hook_user_login().
  */
 function mongodb_session_user_login($edit, $account) {
@@ -23,7 +58,7 @@ function mongodb_session_user_login($edit, $account) {
       'login' => (int) $account->login,
     ),
   );
-  mongodb_collection('fields_current', 'user')->update(array('_id' => (int) $account->uid), $save, array('w' => 0);
+  mongodb_collection('fields_current', 'user')->update(array('_id' => (int) $account->uid), $save, array('w' => 0));
 }
 
 function _mongodb_session_get_roles($account) {
