Improve error detection in Inventory