One of the declarations of flatten() was missing