fix quoting and add proper escaping