various fixes and corrections