For those of you using TWRP on your Galaxy S4, please MAKE SURE to update your TWRP recovery to the latest version 2.6 as previous versions do have bugs where custom ROMs may not install correctly.
Older TWRP worked fine but on certain custom ROMs, it would freeze during installation or the custom ROM would not boot causing bootloops. I found out this is fixed by either using CWM or installing the latest TWRP 2.6.
You can easily update your TWRP by using Goo Manager app OR you can also flash TWRP manually using ODIN and TWRP tar files here. Some Galaxy S4 models may not be supported by Goo Manager so use ODIN and TWRP tar files if that is the case for you.