fix bug with pagination