Fixed core upgrades bug.
Fixes #22.
Fixed some bugs with packagecontrol.