Fix crash when querying unknown graphs