Most often, this happens because of rapid temperature changes. Don't be in a rush to melt that sugar—using high heat will just cause problems. As well, make sure to use a heavy-bottomed saucepan. Something with a thin bottom won't conduct heat as well, leading to hot spots. If you notice the roca separating while still in the pan, just remove it from the heat and swirl it around until it's combined again. If it separates once it's been poured out, there's not much you can do. Blot the oil and if it's super hard, break it into pieces and use it in baking instead.