replaced AtomicBoolean reference with volatile boolean