Fixed bug whereby enabling inventory sorting messed up the removal of items from the inventory