Fix selection of custom indices and custom sub-elements