I just hit this bug using exactly this test case. Thanks for the patch!