fixed upgrade script