fixing mat deletion cascade