Fixes to ISR handling. Needs cleanup.