fixed js errors from pagination