Fix bug when no onStateChange block is set.