The Texas House of Representatives has passed a measure to fund Medicaid through the end of the year. Lawmakers voted unanimously to approve the $6.6 billion emergency spending bill Tuesday. The legislation also covers the $1.7 billion that’s owed to public schools.

The state found itself in this situation after a decision by the state legislature in 2011 to only fund Medicaid for 18 months. It was their way of balancing the budget in the midst of a massive budget shortfall last session.

The legislation passed just two days before funds would have been cut off to medical providers. The measure now heads to Gov. Rick Perry for his signature.