diff --git modules/system/system.admin.inc modules/system/system.admin.inc
index e0fcabb..b7fa006 100644
--- modules/system/system.admin.inc
+++ modules/system/system.admin.inc
@@ -1222,10 +1222,12 @@ function system_modules_submit($form, &$form_state) {
   if (!empty($new_modules)) {
     $sort = array();
     foreach ($new_modules as $key => $module) {
-      if (!drupal_check_module($module)) {
+      if (drupal_check_module($module)) {
+        $sort[$module] = $files[$module]->sort;
+      }
+      else {
         unset($new_modules[$key]);
       }
-      $sort[$module] = $files[$module]->sort;
     }
     array_multisort($sort, SORT_DESC, $new_modules);
     module_enable($new_modules, FALSE);
