fix upgrade script