fix pageing and sorting in table