Regression test for issue #4024