For #26314 - Fixed bugs in upgrader script