Fix #770

Add test for #770
Merge pull request #792 from kix/issue-770

Fix #770