Update scripts, fix some bugs.