support array-like objects (e.g. arguments) when flattening