optimization: do not use AtomicInteger