check array before for each