Upgrade script incorrectly looking for "err"

"err" is not defined and is causing the upgrade script to fail.