Fixed a error when script copies to a wrong directory