Guard against reading off the end of the array