handling spurious interrupts correctly