fixing bug in upgrade script