Fix scheduling state bug

Checks for state sanity when processing events. Merge catchAllHooks and
eventHooks to avoid two phases event processing between these two hooks sets,
that would make lower priority hooks run before higher priority ones.