Bounds check array index. Fixes a crash when len == 1.