Forward-port 3.1.3 upgrade script