fix bugs in state reset and state init
Merge pull request #1 from piskvorky/ziky90-develop

fix bugs in state reset and state init