If your M&Ms keep cracking or losing their shape while baking, try using mini M&Ms. These are smaller and less likely to melt, which is why they're my favorite for this recipe. You can also try freezing your M&Ms before adding them to the dough which will also help them to retain their shape while baking.