Fix bug

Check for onStateChangeBlock being nil before dispatching it.