bug fixes to pagination.