using counter to correct '}' line number.