Fixed a bug in the script switching-mode