add a missing state and improve the state changing in visualization