Fixed -flatten:.

Hopefully this should fix it.

The test passes, but can you please see if it solves the problem in your application's actual code?