Misc fixes and minor improvements.