Fix/statemachine