Modified the script and fix an error