Fot item_data, typeof null returns "object".  So also check that item_data is true before calling delete on it.