add check of current state to avoid transition error