updating default index to be in range