fixed problems with pagination