Fixes #1047
Merge pull request #1066 from msteiger/fix_1047

Fixes #1047