fixing issue with pagination