various fixes and upgrades