fix bug not escaping attachment name
handle invalid payloads