diff --git a/src/host/premake.c b/src/host/premake.c
index 1a497539..88e154ed 100644
--- a/src/host/premake.c
+++ b/src/host/premake.c
@@ -419,11 +419,12 @@ int premake_locate_executable(lua_State* L, const char* argv0)
 		lua_pushstring(L, "/");
 		lua_pushstring(L, argv0);
 
-		if (!path_isabsolute(L)) {
+		if (!do_isabsolute(argv0)) {
 			lua_concat(L, 3);
 		}
 		else {
-			lua_pop(L, 1);
+			lua_pop(L, 3);
+			lua_pushstring(L, argv0);
 		}
 
 		path = lua_tostring(L, -1);