[FIX] XQuery: update checks, https://gist.github.com/JosuaKrause/5877998