Fix link-querying bug