[FIX] XQuery: NPE when checking function implementations; closes #778