removed state-change bug