update counts and stats at end of batch