fixing the encoding of payload