Update update.py

added better exception handling