add proper agent fields,  set encoding