fix bad import and add test

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