volatile boolean variable changing between setup and ISR

Remove both lines below from your interrupt routine. Interrupts are already turned off within an interrupt routine.

  noInterrupts();        // Turn OFF all interrupts during ISR so  flag  is not changed
   volatile boolean flag;

Also remove this line from the end of the ISR, or the ISR itself could be interrupted by another.

   interrupts();         // Turn ON all interrupts