scripts/namespace.pl: improve to get more correct results