Fixed some rather stupid memory errors with allocating for payloads and output file names.