diff --git a/tools/make-frozen.py b/tools/make-frozen.py
index f12e6f6db3c1a8f3436f8515f4c164162d62039e..340a78861716a923a971f5c8070ef2e000eb38ba 100755
--- a/tools/make-frozen.py
+++ b/tools/make-frozen.py
@@ -26,16 +26,14 @@ def module_name(f):
 
 modules = []
 
-root = sys.argv[1]
+root = sys.argv[1].rstrip("/")
 root_len = len(root)
-if root[-1] != "/":
-    root_len += 1
 
 for dirpath, dirnames, filenames in os.walk(root):
     for f in filenames:
         fullpath = dirpath + "/" + f
         st = os.stat(fullpath)
-        modules.append((fullpath[root_len:], st))
+        modules.append((fullpath[root_len + 1:], st))
 
 print("#include <stdint.h>")
 print("const uint16_t mp_frozen_sizes[] = {")