Implement #1575
Test case for #1575
Merge pull request #1581 from sjinks/issue-1575

Fix #1575