Several fixes as per feedback on #r17232214