fix a bug when copying files