state switch fix