Fixed some pagination problems