Fixed some pagination bugs