Fix bug with pagination