Bug fixes in the interrupt handling