I updated #1459 with a more complex test case and a possible fix.