use seperate counter for new arrays, to avoid an index larger than the
array size.