various fixes and improvements.