Some minor bugfixes in the interrupt handling and sleep handling