configurable reports tweaks

each commit is a standalone change, mostly fixing http://manage.dimagi.com/default.asp?146087