Add regression test for issue #247 - broken in master at 4d4abb2, works in 6eda91a