under working,  fix statemachine table, not complete.