Fixes and optimizations for the script which create an anonymized backup of the database.