Fixed a crash if a query node is not in the original graph