Misc fixes

A few non-breaking fixes and improvements.