more robust regex for packages and more checks