Misc fixes from code review