arduino nano random start up failure

I am using arduino nano v3. The problem is : When i connect it to 9 V battery, it sometimes starts , sometimes not. if i connect disconnect battery 10 times, the probability of correct start up is 50%. What could be possible cause of these random failures? Code is attached.

motor_control_without_uart.ino (3.89 KB)

Does the same thing happen with a simple sketch like blink?