various fixes and upgrade