replace() will overwrite data in place if possible