Test if array before using each