Fix crash when Item Type is not set

Also changed the way we get the item type.