check before access the array.