fix 500 for weird form ids

http://manage.dimagi.com/default.asp?102926
Merge pull request #2863 from dimagi/cz

fix 500 for weird form ids