Issue #5192: Fix failing tests on 3.x