As Muslim institutions of higher learning, the madrasa had the legal designation of waqf.  When did the al-Qarawiyin officially stop being a university