Strange behaviour using interrupts