fixed inventory erasing issue