Thermometers will occasionally develop bubbles as portions of the mercury or alcohol separate from the main column. There are a few things you can try if this occurs. Never try to fix a thermometer that is cracked or damaged. Dispose of it properly instead.
Grab the thermometer slightly below its middle with one hand. Make sure the bulb is pointing down. Gently strike the thermometer against the palm of your other hand. Continue the process until the bubbles have cleared.
Take the thermometer and hold it firmly, with the bulb pointing away from you. Raise the thermometer above your head and quickly swing it downward. Stop once the thermometer is in a vertical position. Repeat as necessary. The centrifugal force should clear the bubbles.
Heat the thermometer bulb under hot, running water. Don't heat it too long -- you don't want the mercury or alcohol to rise to the top of the expansion chamber. Once the bubbles are gone, hang the thermometer with the bulb down for several hours.
Be very careful when you're handling a thermometer. Don't treat it too roughly or it will shatter.