An infusion pump includes inlet and outlet valves and a squeezing element configured to squeeze a fluid line coupled to the infusion pump. A method includes at least one round of valve operation check prior to initiation of a delivery session of fluid to a subject, and subsequently, after an intake phase and before a delivery phase of at least one infusion pump cycle, determining for the at least one pump cycle, an absolute amount of air in the fluid line. The valve operation check and the determining of the amount of air each include: (A) closing the inlet valve to confine a section of the fluid line between the inlet and outlet valves; (B) squeezing the confined section; (C) measuring the pressure within the confined section; and (D) subsequently, relieving the pressure in the confined section. Other applications are also described.