Fixed bug where adding an item would crash program