Some final fixes to get pagination working properly.