fixing database tables