--- a/makedoc.g
+++ b/makedoc.g
@@ -38,7 +38,7 @@
     AppendTo(output, "gap> START_TEST( \"", basename, "\");\n\n");
     for a in ch do
       location := a[2][1];
-      pos := PositionSublist(location,LowercaseString(pkgname));
+      pos := PositionSublist(LowercaseString(location),LowercaseString(pkgname));
       if pos <> fail then
         comment := location{[ pos+Length(pkgname)+1 .. Length(location) ]};
       else
