Use 'add' commands rather than 'replace' if the previous key is the same as the current one