fixed upgrade.py