Fixing interrupt handler to not reset deviceNum in loop.