Fixed a state transition issues.