sum and diag work