rewrite update.sh