fix stats and database updates