[Backport] fix for #5123

As requested by @Bart6114

This will then be included if there is a new release from the 0.2 branch