Change ArgumentOutOfRangeException to IndexOutOfRangeException