Stop giving wrong information.
Flashing the rom with the manufacturers software = factory reset

As I said, unless the phone is broken, nothing can prevent that.