fixing if statements for when item is null