switched sed then cp, to cp then sed, added daemon flag back in