only generate counter variable if messages is counted