fix TypeError

http://manage.dimagi.com/default.asp?96821