state change bug fix