as suggested by @peterhoeg in 1b7e5eaa79 (commitcomment-24560631) fixes #30379
1b7e5eaa79 (commitcomment-24560631)
with improvements suggested by Jörg Thalheim <joerg@thalheim.io>