Minor flatten fix

Fix OOM exception