I fixed it ;D
Sry about that, I had an extra raw id lookup in my LoadInventory function (that's why inventory wasn't loading at all). Item charges was also missing a +1 on load item charges.
However, why you were getting invalid codes I don't know. I got it to load just fine in initial buggy versions (although inventory didn't load up because of the double lookup).
Got it to 100% work after the fixes.