Detection of air and gas bubbles