change the replace original file logic