Improved error checking in upgrade test