improved diagnostics handling