Bugfix in query sanitize