Hi Nagasai, although you have not mentioned the type of material (plastic/metal), I would say using a better casting setup (play with temperature, cooling rate, and vacuum) to find a better setup that can mitigate the porosity and crack.
Porosity shows usually that something in your cast evaporates. So look for the vapour pressure of the metals and impurities in your alloy. You could reduce the pores also by raising the pressure under which you cast. And finally of course try to cast with the lowest possible temperature. This will also reduce the cracks.
I agree with all recommendations above. Cracks can be produced by high level of residual stresses. Residual stresses are produced in your case by high temperature gradients. Avoid quick cooling is a good advice.