The lights were flickering, so I called the electrician. They replaced the old light switches and an old light fixture. Still the problem continued. They came back again and said the breaker box had corrosion from moisture. I put a dehumidifier in the basement, and that fixed the problem, no more flickering.
I don't think water is comming directly into the box from outside
The dehumidifier uses 6 amps, and that costs money. How does one "waterproof" a breaker box ? The basement is humid, but there's no water on the floor.