fixed bash logic in upgrade.sh