Interruptions problem

Why are you attaching and detaching the interrupt in loop() ? If you want interrupts not to trigger for a period then disable them using noInterrupts() as long as nothing else that depends on them is happening.

However, the main question is, why are you using interrupts in the first place ?