I've not had any problems with Hagia Sofia.
As to the Great Library, I haven't built that in months. I did notice when I captured it that the city didn't have a regular library, but since it had a public school that just indicates the regular library along with the university got burnt down when I captured the city.