Updated server-side inventory so it works as expected now
Also added bounds checking