Either just flash the wifi patch on your dmg1 bootloader or earlier (random reboots and force closes) or
Flash mj5 bootloader (to be stable)
flash bootloader patch (removes knox, disables wifi)
flash wifi patch (enables wifi)
Yes there are newer bootloaders but these are not yet hackable and will void your warranty bit 0x1. You wont be able to downgrade from them either. Mj5 is the last 'flexible' bootloader
Just flash MJ5 bootloader and then flash ROM. Or, flash ROM first, then flash boot loader. Doesn't really matter, except for the fact that you'll not have Wi-Fi until you'll flash the new bootloader. Yes, you'll need Odin to flash bootloader. And before you'll flash the ROM ensure that you have recent enough recovery that works properly with Android 4.3! This is rarely mentioned but this is extremely important, if you'll not do this then you'll probably end up with the files from your internal SD in the wrong place as file system layout slightly changed after Android 4.1 and old recoveries are not aware of the changes. I recommend PhilZ Touch 5.15.0 (6.x are buggy, don't use them!).
Don't flash any bootloader and/or WI-Fi patches on MJ5, this is incredibly stupid! Bootloader "patch" is just an old bootloader (DMG1 AFAIR), so yes, it'll require Wi-Fi patch and then you can get all these "random reboots and force closes". What is the point of flashing MJ5 if the next thing you'll do is remove it again and get back to square one?!