[FIX] XQuery, GH-657: Better detection for undefined variables.