diff --git a/ldapauth.module b/ldapauth.module
index 83b2e0f..e4ba841 100644
--- a/ldapauth.module
+++ b/ldapauth.module
@@ -398,7 +398,19 @@ function ldapauth_authenticate($form_values = array()) {
     // Save the new login data.
     if (LDAPAUTH_LOGIN_PROCESS == LDAPAUTH_AUTH_MIXED && LDAPAUTH_SYNC_PASSWORDS)
       $data['pass'] = $pass;
-    $user = user_save($account, $data);
+
+    $save = FALSE;
+    foreach (array_keys($data) as $key) {
+      if ($account->{$key} != $data[$key]) {
+        $save = TRUE;
+      }
+    }
+    if ($save) {
+      $user = user_save($account, $data);
+    }
+    else {
+      $user = $account;
+    }
   }
 
   // Save user's authentication data to the session.
diff --git a/ldapgroups.inc b/ldapgroups.inc
index b85cc88..9731eb8 100644
--- a/ldapgroups.inc
+++ b/ldapgroups.inc
@@ -59,7 +59,9 @@ function ldapgroups_user_login(&$account) {
 
   // Store roles in the user object so we know which ones
   // were granted here.
-  user_save($account, array('ldap_drupal_roles' => $roles));
+  if (isset($account->ldap_drupal_roles) && $account->ldap_drupal_roles != $roles) {
+    user_save($account, array('ldap_drupal_roles' => $roles));
+  }
 }
 
 //////////////////////////////////////////////////////////////////////////////
