Add regression test for old issue #507