added self-removal to generated scripts