Question about nandroid backus I am using twrp 3.0.2 for backup and restore on my galaxy s4 i9506 and i dont understand some things.

I wanted to be able to switch between 5.0.1 and 4.3 by having backups of both versions. 

So i backed up my phone running android 5.0.1. I then wiped my phone and flashed the 4.3 rom. Now my phone is on 4.3.

After that i made a backup of my phone on 4.3. Now i have the backups of 4.3 and 5.0.1.

When i tried to restore the 5.0.1 backup on the 4.3 system, it would get stuck at the "galaxy s4" boot screen. The 4.3 system would only accept 4.3 backups. (likewise, if i flash 5.0.1, it will also only accept 5.0.1 backups)

Furthermore, when i restore the 4.3 backup with a 5.0.1 system, the "galaxy s4" boot screen will be still be the one from 4.3. (the one from 4.3 has vibration while 5.0.1 doesnt). 

This also happens when i try to flash custom roms (it gets stuck at the galaxy s4 boot screen, and it is the same screen as the previous OS). Hence, i am unable to flash any custom rom.

I thought that nandroid backups are supposed to restore the entire system to the way it was (exept internal and external sd cards), i dont understand why it does not. I also dont understand why the galaxy s4 boot screen does not change when restoring or flashing custom roms. 

I tried to make this as clear as possible, thanks for reading!
First of all, be advised that Nandroid backups, in some situations aren't able to backup the "boot.img" properly, or isn't able to properly restore the "boot.img", even if it was backed up properly. When either of that happens, you're going to end up stuck like the way you are at the moment. The issue you're facing can also turn up, in case the partitioning structure is different between roms of two different android versions (one being more recent than the other, probably). Difference in the number and type of partitions being created by each backup can also lead to situations in which some data is wiped (upon restoring another), which some traces are still leftover.


  I thought that nandroid backups are supposed to restore the entire
  system to the way it was (exept internal and external sd cards), i
  dont understand why it does not.


Nandroid backups rely on the state of other things such as the custom recovery, the "boot.img" and the rom, in order to work properly. Think of it as having multiple variables in an equation; wherein even if one of them isn't working well with the others, its probably not going to be working as smoothly and perfectly as you would expect it to.

Therefore, my first suggestion would be to make a second copy of your existing nandroid backup on your computer (being extra safe here, so as to not possibly corrupt the existing one).

0> Then, open/extract the nandroid backup and see if it contacts a "boot.img". If it does, you're in luck. Otherwise, you will need to source a "boot.img" for your phone from the internet (which may or may not work). Either way, this recently obtained "boot.img" will be used in a moment.

1> Backup your existing boot.img using TWRP as a separate backup, selecting only the boot partition and nothing else for this particular backup.
(This will give you a backup containing your existing "boot.img", which is present on the phone at the moment. Also make note which rom this "boot.img" goes with (4.3/5.0.1), based on what is currently installed on the phone)

2> Wipe all partitions currently existing on your phone using TWRP. Use the fastboot mode to flash the "boot.img" obtained in step 0, above. Please make sure this "boot.img" goes along with the rom you will try to use with it, thereafter.

3> Within TWRP, do a partial restore, restoring ALL partitions existing within the backup except the boot partition (as we have already dealt with that).