fix code errors
add payloadlength to logs