Some random fixes and improvements.