a lot of minor fixes and upgrades