added counter backport for py2.6 support