Supercooling and superheating effects in heterogeneous systems