diff --git a/sites/all/modules/contrib/profile2_regpath/profile2_regpath.install b/sites/all/modules/contrib/profile2_regpath/profile2_regpath.install
index 56d0fb0..6e7c2e9 100755
--- a/sites/all/modules/contrib/profile2_regpath/profile2_regpath.install
+++ b/sites/all/modules/contrib/profile2_regpath/profile2_regpath.install
@@ -190,13 +190,13 @@ function profile2_regpath_update_7132() {
   $regpaths = $result->fetchAll();
 
   // Only store role that is enabled.
-  // Use role name instead of role id
+  // Use role id instead of role name, otherwise assigning role does not work
   foreach ($regpaths as $regpath) {
     $roles = unserialize($regpath->roles);
     $updated_roles = array();
     foreach ($roles as $role_id => $enable) {
       if ($enable) {
-        $updated_roles[$role_id] = db_query("SELECT r.name FROM {role} AS r WHERE r.rid = :rid", array(':rid' => $role_id))->fetchField();
+        $updated_roles[$role_id] = db_query("SELECT r.rid FROM {role} AS r WHERE r.rid = :rid", array(':rid' => $role_id))->fetchField();
       }
     }
 
diff --git a/sites/all/modules/contrib/profile2_regpath/profile2_regpath.module b/sites/all/modules/contrib/profile2_regpath/profile2_regpath.module
index e86d5ed..722f878 100755
--- a/sites/all/modules/contrib/profile2_regpath/profile2_regpath.module
+++ b/sites/all/modules/contrib/profile2_regpath/profile2_regpath.module
@@ -389,11 +389,11 @@ function profile2_regpath_save_settings($form, &$form_state) {
   );
 
   // Add roles if enabled.
-  // Use role name instead of role id
+  //Use role id instead of role name, otherwise it is not possible to assign a role during registration
   $roles = array();
   foreach ($form_state['values']['roles'] as $role_id => $enable) {
     if ($enable) {
-      $roles[$role_id] = db_query("SELECT r.name FROM {role} AS r WHERE r.rid = :rid", array(':rid' => $role_id))->fetchField();
+      $roles[$role_id] = db_query("SELECT r.rid FROM {role} AS r WHERE r.rid = :rid", array(':rid' => $role_id))->fetchField();
     }
   }
   $fields['roles'] = serialize($roles);
