fixed pagination bugs