make writes atomic