fixed directory and file.copy issues