Bug fix: paginate() passes incorrect argument to count()