fixed bug in AgentInventory.pop