It might be something to do with this: have a look at the section about disabling interrupts in critical sections in this Nick Gammon forum post.
It might be something to do with this: have a look at the section about disabling interrupts in critical sections in this Nick Gammon forum post.