initialized self.counter and reset when the block resets