Misc fixes and improvements.