Small simplification of array element checks, fixed exceptions.