Fixes issue #1087.
Merge pull request #1091 from ne0fhyk/fix_issue_1087

Fixes issue #1087.