Different behavior of the sketch if Arduino is powered by battery

I used a 7.4V, 1200mAh RC battery. The Arduino is an UNO R3.