update.py: fix scope issue