Assorted fixes for code review