fixed array index out of bounds exception