Update write_stats_to_db.sh