revised upgrade script