arduino nano atmega328 copy, writing flash

i bought a copy of the arduino nano with the atmega328p or atmega328pb not quite sure.
it worked fine for a while but now i sometimes have problems uploading sketches and if i succeed in uploading a sketch the programm seems to fail after a couple of repetitions. so im guessing there is some problems with writing the flash properly. i tried looking for similar issues in the forum and found out about burning boot loaders to optiboot, but im having trouble understanding the full process and im not sure if thats the right thing to solve my problem.
if someone has some infos or can give me a brief that would be great.