fix database structure