fixed the escaping logic in here