Fixes #2355

The issue is explained in issue #2355. This fixes said issue.