Your program looks ridiculously complicated.
How do you actually "know" that it never makes it into the loop() function ?