Declare templabelcount as a global in atom().

I found this buglet using `pyflakes` -- `templabelcount` needs to be defined (at toplevel) and declared `global` in order for `atom()` to correctly see it.  (Note, though, that I haven't tested this code path either before or after this change.)