backport #2132 to maintenance

fixes #2833