Fix broken XML serialization

Not a fix that I'm very happy with, but seems to fix the problem for now. Would like to find a better way in the long term.

http://manage.dimagi.com/default.asp?112278