adapt upgrade script