Fixed a bug when the console executes /spec on or /spec off (ClassCastException)