Fixing pagination
Modified some logic in core, may need figure out a way to avoid this