Fix bug where script dies on pages with no image