Regression test for #1345
Fix #1345