Fixed glibc errors, added patch for query fix.