Looks like this will work in your testcase from issue #840 . Did you test on anything large though? I wonder if we don't need a more complete solution here.