Little package cache fixes

@ekatek Can you see any problems with these changes?

Archaeology tells me that the self.firstRun bug was introduced by Geoff in 608123d886f1ed848de42d8860bafe48eb4a0bff (0.9.0) and I think the PackageCache as part of the sqlite refactor in 0.9.4.

I am planning on doing some deeper changes too on a branch, but I think these can be merged immediately pending your review?