out of bounds array fix