fixed logic to archive files