fix error in stateObserver and tool.js