corrected modgen script