Refine atomics changes to make it more foolproof.