Fix bug selecting an occurrence when the already in the buffer.