Fix #1561
Merge pull request #1589 from Varriount/fix-1561

Fixes #1561