maxint is 2^32-1
Merge pull request #562 from oetiker/counter-wrap-fix

maxint is 2^32-1