Upgrades and bug fixes