Issue 3681 tweaks

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.4+
| Fixed tickets |

Reapply some fixes to #3681 that probably got lost with #3695.