improve migration script; fix update tool bug