flatten was used incorrectly