tweaks to script to dump database for reporting