Fix index bug with pagination.