Electronic relaxation and chemical shifts in x-ray photoelectron spectra