removing an atomicity violation