multiple fixes and improvements