ENG-4907: fix broken IndexCounter, Overflow handling in IndexScan, and some Junit tests.