Changed execution of material output and improved tests (#3096)