Fix resultItems index out of bounds