Several fixes in the package manager code,
making it actually work