More diag and error stuff.