fix issues with pagination