Index: bueditor.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bueditor/bueditor.admin.inc,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 bueditor.admin.inc
--- bueditor.admin.inc	10 Jun 2008 07:54:04 -0000	1.3.2.2
+++ bueditor.admin.inc	2 Dec 2008 21:10:49 -0000
@@ -81,7 +81,8 @@
     unset($roles['u1']);
   }
   if (count($roles) > 3) {
-    uasort($roles, 'bueditor_rolesort');
+    variable_set('bueditor_roles', $roles);
+    $roles = bueditor_sorted_roles(TRUE);
   }
   variable_set('bueditor_roles', $roles);
   drupal_set_message(t('Changes have been saved.'));
@@ -464,9 +465,9 @@
 /**
  * Sort roles according to their weights.
  */
-function bueditor_sorted_roles() {
+function bueditor_sorted_roles($reset = FALSE) {
   static $sorted;
-  if (!isset($sorted)) {
+  if ($reset || !isset($sorted)) {
     $sorted = array();
     $roles = user_roles();
     $broles = variable_get('bueditor_roles', array());
@@ -489,7 +490,7 @@
  * user sorting function for roles.
  */
 function bueditor_rolesort($r1, $r2) {
-  return $r1['weight']-$r2['weight'];
+  return $r1['weight'] > $r2['weight'] ? 1 : ($r1['weight'] == $r2['weight'] ? 0 : -1);
 }
 
 /**

