misc fixes and improvements