diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 201e65b414d67a2fa6b57bd505deedbd4b282ac7..b78b2790889c27330c2e31b025aef43bdcc90e39 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -175,16 +175,17 @@ $modules = array();
 $orders = array();
 $categ = array();
 $dirmod = array();
+$i = 0;	// is a sequencer of modules found
+$j = 0;	// j is module number. Automatically affeted if module number not defined.
 foreach ($dirlist as $dirroot)
 {
 	$dir = $dirroot . "/includes/modules/";
 
 	// Charge tableaux modules, nom, numero, orders depuis r�pertoire dir
 	$handle=opendir($dir);
-	$i = 0;
-	$j = 0;
 	while (($file = readdir($handle))!==false)
 	{
+		//print "$i ".$file."\n<br>";
 	    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod'  && substr($file, strlen($file) - 10) == '.class.php')
 	    {
 	        $modName = substr($file, 0, strlen($file) - 10);
@@ -219,6 +220,7 @@ foreach ($dirlist as $dirroot)
 		            $modules[$i] = $objMod;
 		            $filename[$i]= $modName;
 		            $orders[$i]  = "$objMod->family"."_".$j;   // Tri par famille puis numero module
+					//print "x".$modName." ".$orders[$i]."\n<br>";
 					$categ[$objMod->special]++;					// Array of all different modules categories
 		            $dirmod[$i] = $dirroot;
 					$j++;
@@ -227,11 +229,12 @@ foreach ($dirlist as $dirroot)
 	        }
 	    }
 	}
-}
 
+}
 
 asort($orders);
 
+
 // Affichage debut page
 
 if ($mode==0) print $langs->trans("ModulesDesc")."<br>\n";