Atomic: fix race condition in unit tests