fix for xml and json encoding