Fixes #542
Merge pull request #1336 from Varriount/fix-542

Fixes #542