Fix inventory bugs

Fixed a bug with swap causing undefined elements in the inventory to be created. Also fixed the addInventory function in scenario.js to work properly with an array.