Basic inventory overflow fix (2). Warning: It doesn't fix inventory overflow completely.