Avoid writing to target file unless there was a change