array upper bound check