[Jackie] fsm.py modification: callbacks added