the acid in the potatoes tends to make the cream curdle. Did you blanche the potatoes in milk? and make sure that the oven doesn't get too hot 160 max You can also add a tiny bit of flour to the mix, and if you use waxy potatoes, the starch content will help to stop further curdling.