More tolerant upgrade script