Fix #797
Merge pull request #806 from sklam/fix797

Fix #797