add state machine to bug