Bug fixes to packaging system.
* Overflow bug in package management
* Removal of packages can result in vital packages also being removed.