need to fix target file writting to avoid removing it