Can no sent right config fix #26

Also add som print/write to log. Fixed a potential bug in
EncodeDecodeXml