Adjusted indexing of vars with index 0

Special Thanks to Haruna. Also fixed a compiler warning, thanks to ossi0110

Signed-off-by: shennetsind <ind@henn.et>
Fixed ERS Cache sharing

Enforcing cache to match the option condition in order for it to be shared. Special Thanks to Haruna!

Signed-off-by: shennetsind <ind@henn.et>