Bacterial resistance to toxic elements