Fixes issues with state transition.