check if array-like before attempting flatten
Loop in place of push.apply