fixed more compilation errors, fixed state machine triggers.