Fixes for xml encoding and sending