Fix part 2, making upgrade slightly smarter