add copy file functionals and some fixes