ensure subarray exists before element referenced