Further package download logic fixes to ensure a package is not potentially entered into the resource cache several times, and that packages in the cache are scanned for only when necessary.