fix issue with iterating arrays