Fixed a few bugs for package installation and config