counter must be declared