diff --git a/core/trunk/core/class/users_controler.php b/core/trunk/core/class/users_controler.php
index f32f0da45e30da5324c4afcf59fd51e013dc57ee..a2a732a601c5eb55307b538f7fef7449aa86d2a3 100644
--- a/core/trunk/core/class/users_controler.php
+++ b/core/trunk/core/class/users_controler.php
@@ -789,7 +789,7 @@ class users_controler extends ObjectControler implements ObjectControlerIF
                        . $func->protect_string_db($userId) . "', '"
                        . $func->protect_string_db($array[$i]['GROUP_ID'])
                        . "', '". $func->protect_string_db($array[$i]['PRIMARY'])
-                       . "', '" . $func->protect_string_db($array[0]['ROLE'])
+                       . "', '" . $func->protect_string_db($array[$i]['ROLE'])
                        . "')";
                 try{
                     self::$db->query($query);