Fix for query size, using memory size instead of number of characters

this fixes my problems with unicode queries