code review comments for #819 and #820