counter: move some init code to the start of decode()