fix state mechine problem!