Sketch is not working with Nano perfectly like Mega2560

Can you try another Nano?

I run rather complex sketches with Nanos and never had problems, but maybe your application drives it to its limits, although I doubt that.