diff --git a/library/init.tcl b/library/init.tcl
index d8de540..1ea6807 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -689,13 +689,15 @@ proc auto_execok name {
 	}
     }
 
-    foreach dir [split $path {;}] {
-	# Skip already checked directories
-	if {[info exists checked($dir)] || ($dir eq "")} {
-	    continue
-	}
-	set checked($dir) {}
-	foreach ext $execExtensions {
+    # KD : reversed the loops to match search order in [exec]
+    foreach ext $execExtensions {
+        unset -nocomplain checked
+        foreach dir [split $path {;}] {
+            # Skip already checked directories
+            if {[info exists checked($dir)] || ($dir eq "")} {
+                continue
+            }
+            set checked($dir) {}
 	    set file [file join $dir ${name}${ext}]
 	    if {[file exists $file] && ![file isdirectory $file]} {
 		return [set auto_execs($name) [list $file]]
