Supercell models are often used to calculate the electronic structure of local perturbations from the ideal periodicity in the bulk or on the surface of a crystal or in wires. When the defect or adsorbent is charged, a jellium counter charge is applied to maintain overall neutrality, but the interaction of the artificially repeated charges has to be corrected, both in the total energy and in the one-electron eigenvalues and eigenstates. This becomes paramount in slab or wire calculations, where the jellium counter charge may induce spurious states in the vacuum. We present here a self-consistent potential correction scheme and provide successful tests of it for bulk and slab calculations.