Replace replace() call with set()

* Added TODO note about atomicity (which was never there)

Change-Id: Ib9907bd2e0619891784a3b91f042424935ba4cec