Fixes #2737

If I understand the description right, here is the solution.