fixed flip and diag1