Fixes from code review on #1161

Fixes from code review on #1161