Reset centerIndex if out of bounds instead of crashing