fix database errors