Improve bounds checking for array accessor functions