diff --git a/unix/main.c b/unix/main.c
index f67c257cd75c4ef9160c7d5f97aa7a8f1c85c64b..ad654780d23c0149a1333002d3fcefef5a964cf2 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -428,6 +428,9 @@ MP_NOINLINE int main_(int argc, char **argv) {
         #endif
     }
     mp_uint_t path_num = 1; // [0] is for current dir (or base dir of the script)
+    if (*path == ':') {
+        path_num++;
+    }
     for (char *p = path; p != NULL; p = strchr(p, PATHLIST_SEP_CHAR)) {
         path_num++;
         if (p != NULL) {