Fixing upgrade script