Fixes for upgrade script execution