diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module
index b888814..9f9f606 100644
--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -348,10 +348,10 @@ function simplesaml_auth_user_profile_form_submit(&$form, $form_state) {
       db_merge('authmap')
         ->key(array(
           'uid' => $values['uid'],
-          'module' => 'simplesamlphp_auth',
         ))
         ->fields(array(
           'authname' => $values['name'],
+          'module' => 'simplesamlphp_auth',
         ))
         ->execute();
     }
