fix bugs for GlobalCounter.scala