Ensure that SecondInvariant routine is called for all materials during non lienar iterations. Also add some write statements.