better error message if body ref is not a scalar
avoid an undef warning in debug_structure

[rt.cpan.org #82388]
some doc improvements

closes #5