fixed potential crash when a test runs before a statemachine is assigned