Fungi grow best in dark, moist habitats, but they can be found wherever organic material is available. Moisture is necessary for their growth, and they can obtain water from the atmosphere as well as from the medium upon which they live. When the environment becomes very dry, fungi survive by going into a resting stage or by producing spores that are resistant to drying. The optimum pH for most species is 5.6, but some fungi can tolerate and grow in pH ranging from 2 to 9. Certain fungi can grow in concentrated salt solutions or sugar solutions, such as jelly or jam, which prevents bacterial growth. Fungi also thrive over a wide temperature range. Even refrigerated food may be susceptible to fungal invasion.