Fixes #4223: Move r30555, 30557, r30559 to v1.7 branch

---svn-pre-commit-ignore-below---

r30559 [[BR]]
Fix typo and portability issue in r30555

cmr=v1.7.4:ticket=#4223