       (org-preview-latex-fragment))
 
      ((eq type 'link)
-      (let ((path (org-element-property :path (org-element-context))))
+      (let ((path (org-element-property :path (org-element-lineage context '(link) t))))
         (if (and path (image-type-from-file-name path))
             (+org/refresh-inline-images)
           (org-open-at-point))))

;;;###autoload
(defun +org/toggle-checkbox ()
  (interactive)
  (when-let (context (+org--get-context '(item)))
    (org-end-of-line)
    (org-beginning-of-line)
    (if (org-element-property :checkbox context)

          (org-table-recalculate t)
        (org-table-align)))

     ((org-element-property :checkbox (org-element-lineage context '(item) t))
      (org-toggle-checkbox))

     ((and (eq type 'headline)
