fixed pagination bugs and empty query string bug