Script generation fixed