Assorted fixes and improvements