Fix a crash-on-quit bug
Allow specifying max_iterations in material scripts
Make the default max_iterations 8, rather than 1