Fix tests; add guard to lightbox cleanup