Fixed some errors on change the mode.