Add valid index assertion