fix database upgrade