ok finally atomic write works