fixed bugs in the atomic_flag class