fix mat delete