Safe write