diff --git a/ldap_authentication/ldap_authentication.module b/ldap_authentication/ldap_authentication.module
index 3b1409c..56ec666 100644
--- a/ldap_authentication/ldap_authentication.module
+++ b/ldap_authentication/ldap_authentication.module
@@ -196,20 +196,12 @@ function _ldap_authentication_verify_user_profile() {
   $result = TRUE;
   // We only want non-anonymous and non-1 users.
   if ($user->uid > 1) {
-    // we store the value in the session for speed.
-    if (isset($_SESSION['ldap_authentication_template']) &&
-            isset($_SESSION['ldap_authentication_template']['verify_user_profile'])) {
-      return $_SESSION['ldap_authentication_template']['verify_user_profile'];
-    }
     if (ldap_authentication_ldap_authenticated($user)) {
       $auth_conf = ldap_authentication_get_valid_conf();
       $regex = '`' . $auth_conf->templateUsagePromptRegex . '`i';
       if (preg_match($regex, $user->mail)) {
         $result = FALSE;
       }
-      $_SESSION['ldap_authentication_template'] = array(
-        'verify_user_profile' => $result,
-      );
     }
   }
   return $result;
@@ -233,7 +225,7 @@ function ldap_authentication_check_for_email_template() {
     $url = 'user/ldap-profile-update';
     $cp = current_path();
     // avoid redirects on these two pages.
-    if ($cp != $url && $cp != 'user/logout') {
+    if ($cp != $url && $cp != 'user/logout' && substr($cp, 0, 17)!= 'user/change-mail/') {
       if (isset($_GET['destination'])) {
         unset($_GET['destination']);
       }
diff --git a/ldap_authentication/ldap_authentication.pages.inc b/ldap_authentication/ldap_authentication.pages.inc
index 06678fa..4eb7910 100644
--- a/ldap_authentication/ldap_authentication.pages.inc
+++ b/ldap_authentication/ldap_authentication.pages.inc
@@ -53,8 +53,6 @@ function ldap_authentication_profile_update_form_submit($form, &$form_state) {
   if (user_save($user, array(
     'mail' => $form_state['values']['mail'],
   ))) {
-    // prevents the cached setting from being used again.
-    unset($_SESSION['ldap_authentication_template']);
     $form_state['redirect'] = isset($_GET['next']) ? $_GET['next'] : '<front>';
     drupal_set_message(t('Your profile has been updated.'));
   }
