Arduino nano doesn't accept the code

Have you updated AVR boards to 1.6.21?
If you have, select Tools > Processor > ATmega328P (Old Bootloader).