fixed directory creation and file copying