fix bugs with DIAG