Fix indexRotate method