Update script & fix bugs.