fixed pagination bugs.