fix readable forms in the case of a top-level ref-less group

fixes http://manage.dimagi.com/default.asp?124053

first commit fixes, second commit adds regression test
not knowing too much about how this works - are you at all worried this will get raised on other nonstandard forms? or was this assertion already implicit elsewhere in the code.