Created by: cvrebert
This is just a tweaked version of #15952. Fixes #15951 (closed). CC: @hnrch02 for final review