properly restore the interrupt flag in the handlers