Add regression test for #639