handle index is null