[1.5.x] Fixed test failures introduced in a5becad9094e5c5403b692b9a7b3a6ffaabf64a3.

Backport of 780fa48f5fb81b2f0f58de95167abff84a6149aa from master