ensure 2d index