Fixes #7571

This fixes #7571, tried and tested.