do necessary query escaping