Fixed bug: instrumented handler was not counting states correctly.