fixed script generator - material refinements
fixed loops in preprocessor after running script