update the counter