more robust quoting/escaping