Fixed bugs when adding the scripts