Fixes

Small quick fixes for upgrade script.