Fermi level stabilization at semiconductor surfaces