[Encoder] fix range of slice idx