[Backport] fix for #5123

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