Fix QueryAsList function