Table line counts skipping numbers on page break

There could be a table change in between that causes the sum variable to be incremented too often. This article should help you: