And while we are at it, fix one incorrect error propagation. (cherry picked from commit 15c689d7) (cherry picked from commit 5b45c272)