Atmega 328p program transfered on atmega 328

Not on your sketch, just on the programmer that checks what chip it is talking to.
If you find the '328P section of AVRDUDE.conf and change the 3 bytes to that of the 328, it should bootload ok. Then change avrdude.conf back.