fix file copy code