Testcase and tentative fix for #1237