Fixed illegal state pattern