try to hack around python scope rules for counter