fix some array index out of bounds.
fix some array index out of bounds.