fixing type error in custom export

Fix for http://manage.dimagi.com/default.asp?83954#484328

Unable to reproduce the error locally, so should verify in production that the error is caught.