Forward-port 3.1.8 upgrade script