Sculpting bug

Sometimes while sculpting i get this weird mesh destruction and undo don’t work.
This happens with the crease brush, not sure if it happens to the other brushes to.
Is there a way to avoid this?