various fixes and tweaks from a while ago