Fix use of atomics