add wrap function to force objects to ints

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