fixed pagination bugs (actually fixed bugs)