Better catch problems with packages
We were only properly handling packages with an unsupported type, printing nice error messages about them.
But then when a package was missing a type, we would just crash.
This commit fixes that, so that both kind of problems are properly reported to the user.