fix script generation to actually work.