update the generator and counter