Test case for #1504
Fix #1504
Merge pull request #1507 from sjinks/issue-1504

Fix #1504