Surface effects on metal/CdTe junctions and CdTe heterojunctions