only writing if the file is different