It worked fine with the Azalea save editor website by just changing the drop down menu from female to male. So if changing it in pkhex causes it to break, then it is a fault of the program not doing it correctly. Since the azalea save editor hasnt been updated and PKHEX is like the only other save editor, it would be really helpful if it worked properly.