Corrected a lot of faults. Try to fix attach. Now wrong file is copied