don't dereference iter when checking for NULL