diff -Naur neko.orig/vm/main.c neko/vm/main.c
--- neko.orig/vm/main.c	Sat Apr  7 02:41:52 2007
+++ neko/vm/main.c	Sat Jul 28 01:30:20 2007
@@ -29,6 +29,8 @@
 #endif
 #ifdef NEKO_POSIX
 #	include <signal.h>
+#	include <sys/stat.h>
+#	include <limits.h>
 #endif
 
 #ifdef NEKO_INSTALLER
@@ -61,6 +63,40 @@
 		char *p = getenv("   "); // for upx
 		if( p == NULL )
 			p = getenv("_");
+		if( p == NULL ) {
+			const char *syspath = getenv("PATH");
+			const char *progname = getprogname();
+			if( !path )
+				return p;
+
+			char *syspathdup = strdup(syspath);
+			if( !syspathdup )
+				return p;
+
+			char *tmppath = syspathdup;
+			char *token = NULL;
+			char *last_token = NULL;
+			char check_path[PATH_MAX];
+			struct stat file_stat;
+			for( token = strtok_r(tmppath, ":", &last_token); 
+				token; 
+				token = strtok_r(NULL, ":", &last_token) ) {
+				snprintf(path, 200, "%s/%s", token, progname);
+				if( realpath(path, check_path) && stat(check_path, &file_stat) == 0 ) {
+					length = snprintf(path, 200, "%s", check_path);	
+					if( length < 200 ) {
+						break;
+					}
+				}
+			}
+
+			if( token ) {
+				p = path;
+			}
+
+			free(syspathdup);
+		}
+
 		return p;
 	}
 	path[length] = '\0';
