The invention relates to the prevention of bacterial spoilage during fermentation. In particular it relates to the prevention of beer and wine spoilage, but also the spoilage of bioethanol or biogas. This is accomplished by modifying the fermentation yeast to produce an antimicrobial peptide known as a defensin. One such defensin is the human β-defensin-3 (HBD-3) although many others can be used.