Regardless of your feelings about bats, you owe them a thank you. Without bats, there would be no tequila. Just as you fuel your night on the agave spirit, bats fuel their night on agave nectar. The wild bat population in Mexico is directly linked to the agave crop that produces tequila, which can only be made in the states of Jalisco, Guanajuato, Michoacán, Nayarit, and Tamaulipas.

But thank those bats in northern Mexico now, because the relationship has seen some rough patches and is anything but certain. Here’s everything you need to know about the relationship between bats and tequila.

How bats help tequila producers

There are 138 species of bats in Mexico, and more than 180 species of agave. Tequila can only be made with the blue agave species, while mezcal can be made with any species. In the wild, bats fly out to the agave plants, drawn to the bugs and nectar. They drink from the agave flowers, simultaneously spreading agave seeds.

The bats are the primary pollinators of agave. By feeding from plant to plant, bats promote genetic diversity in new agave plants. It’s not the only way new agave sprouts, though. Agave can also sprout through monocropping, or “bulbillo.”

Monocropping is when a single plant is harvested before it blooms. Sprouts grow from the root, and those sprouts, which are genetically identical to the parent agave plant, are replanted. This results in more tequila in the short term because the plants that are chosen to repopulate have more sugar and a larger yield. Monocropping decreases the genetic diversity of agave, however, making it more susceptible to disease.

Monocropping also decreases the bat population, since the bats no longer have flowers to feed on. That drives the bats away, making monocropping one of the sole ways agave farmers have to grow more plants.

The perilous future of bats and agave

Tequila demand doesn’t run on the bats’ schedule, though, which is why many producers turned to monocropping to boost supply.

The negative impact that monocropping has on both tequila and bats is most clear in the case of the lesser long-nosed bat in the 1980s and 1990s. Rows and rows of agave plants were planted using monocropping. The lesser long-nosed bat population fell to less than 1,000 in 1988. Then, in the 1990s, a fungus ate through the agave fields, causing a shortage that was exasperated by overproduction and poor land management.

But there’s hope. Tequila Ocho and two other tequila makers are focusing on bat-friendly practices. The companies allow at least five percent of the agave plants they own reach full maturity and flower. Practices like Tequila Ocho’s have helped bring the lesser long-nosed bat population up to over 200,000. Soon, the bat will be taken off the endangered species list.

As for the tequila-producing agave? Thankfully it’s a little more diverse, which means there’s less of a chance your cup will run dry.