#16941 update counter after displaying output first.