Fixed storeItem function when merging stacks