fix allocateInventory API functions & tests