[1.7.x] Fixed #23148 -- Minor tweaks in tutorial code samples

Backport of e075d2e66baae98c5b5c06bff384665ab50e0223 from master.