Fix issue with serializing unicode queries.