The interaction of plume heads with compositional discontinuities in the Earth's mantle